Changeset 16832 for trunk/FACT++/src
- Timestamp:
- 06/14/13 10:51:45 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/WindowLog.cc
r12959 r16832 135 135 fMuxFile.lock(); 136 136 fLogFile.close(); 137 fMuxFile.unlock(); 138 } 139 140 void WindowLog::WriteFile(const string &sout) 141 { 142 fMuxFile.lock(); 143 fLogFile << sout; 144 fLogFile.flush(); 137 145 fMuxFile.unlock(); 138 146 } … … 220 228 } 221 229 230 fQueueFile.emplace(sout); 231 /* 222 232 // Output everything also to the log-file 223 233 fMuxFile.lock(); 224 234 fLogFile << sout; 225 fLogFile.flush();235 //fLogFile.flush(); 226 236 fMuxFile.unlock(); 227 237 */ 228 238 // If we are flushing because of an EOL, we reset also all attributes 229 239 } -
trunk/FACT++/src/WindowLog.h
r11942 r16832 8 8 9 9 #include <ncurses.h> // A_NORMAL etc 10 11 #include "queue.h" 10 12 11 13 /// Stream manipulators to change the color of a WindowLog stream … … 74 76 std::mutex fMuxWindow; /// Mutex securing output to fWindow 75 77 78 Queue<std::string> fQueueFile; 79 76 80 static std::string GetAnsiAttr(int m); 77 81 … … 79 83 void AddColor(int m); 80 84 85 void WriteFile(const std::string &); 81 86 void WriteBuffer(); 82 87 … … 93 98 //! Switch on screen output 94 99 // 95 WindowLog() : std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true) 100 WindowLog() : std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true), 101 fQueueFile(std::bind(&WindowLog::WriteFile, this, std::placeholders::_1)) 96 102 { 97 fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering103 //fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering 98 104 setp(&fBuffer, &fBuffer+1); 99 105 *this << '\0'; 100 106 } 101 WindowLog(WindowLog const& log) : std::ios(), std::streambuf(), std::ostream((std::streambuf*)&log), fWindow(log.fWindow), fIsNull(false), fEnableBacklog(true) 107 WindowLog(WindowLog const& log) : std::ios(), std::streambuf(), std::ostream((std::streambuf*)&log), fWindow(log.fWindow), fIsNull(false), fEnableBacklog(true), 108 fQueueFile(bind(&WindowLog::WriteFile, this, std::placeholders::_1)) 102 109 { 103 fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering 110 //fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering 111 } 112 ~WindowLog() 113 { 114 fQueueFile.wait(false); 104 115 } 105 116
Note:
See TracChangeset
for help on using the changeset viewer.