|
|
@@ -43,16 +43,16 @@ class DiscLogger : private cd::Thread { |
|
|
|
private: |
|
|
|
cd::Mutex BufferControlMutex; // Protects buffers while swapping. |
|
|
|
cd::Mutex FlushMutex; // Protects flush operations. |
|
|
|
string myPath; // Where the file should be written. |
|
|
|
string BufferA; // Log data buffer A. |
|
|
|
string BufferB; // Log data buffer B. |
|
|
|
std::string myPath; // Where the file should be written. |
|
|
|
std::string BufferA; // Log data buffer A. |
|
|
|
std::string BufferB; // Log data buffer B. |
|
|
|
bool UseANotB; // Indicates the active buffer. |
|
|
|
bool isDirty; // True if data not yet written. |
|
|
|
bool isBad; // True if last write failed. |
|
|
|
bool isTimeToStop; // True when shutting down. |
|
|
|
bool inAppendMode; // True when in append mode. |
|
|
|
string& FlushingBuffer() { return ((UseANotB)?BufferA:BufferB); } // Returns the buffer for flushing. |
|
|
|
string& PostingBuffer() { return ((UseANotB)?BufferB:BufferA); } // Returns the buffer for posting. |
|
|
|
std::string& FlushingBuffer() { return ((UseANotB)?BufferA:BufferB); } // Returns the buffer for flushing. |
|
|
|
std::string& PostingBuffer() { return ((UseANotB)?BufferB:BufferA); } // Returns the buffer for posting. |
|
|
|
bool isEnabled; // True when this should run. |
|
|
|
void myTask(); // Write back thread task. |
|
|
|
|
|
|
@@ -60,12 +60,12 @@ class DiscLogger : private cd::Thread { |
|
|
|
DiscLogger(string N = "UnNamed"); // Constructs and starts the thread. |
|
|
|
~DiscLogger(); // Flushes and stops the thread. |
|
|
|
|
|
|
|
string Path(const string PathName) { // Sets the file path. |
|
|
|
std::string Path(const string PathName) { // Sets the file path. |
|
|
|
cd::ScopeMutex NewSettings(BufferControlMutex); |
|
|
|
myPath = PathName; |
|
|
|
return myPath; |
|
|
|
} |
|
|
|
string Path() { // Returns the file path. |
|
|
|
std::string Path() { // Returns the file path. |
|
|
|
cd::ScopeMutex DontMove(BufferControlMutex); |
|
|
|
return myPath; |
|
|
|
} |