Changeset 2519
- Timestamp:
- 11/17/03 14:29:54 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2516 r2519 3 3 4 4 -*-*- END OF LINE -*-*- 5 2003/11/17: Thomas Bretz 6 7 * mbase/MLog.cc: 8 - replaced pthread_mutex by a TMutex 9 - renamed fgui to fGui 10 - renamed fout to fOut 11 12 * mbase/MStatusDisplay.cc: 13 - removed ==13 using TryLock() (this was wrong) 14 15 16 5 17 2003/11/15: Thomas Bretz, Abelardo Moralejo 18 19 REMARK: These changes are preliminary! I want to implement a 20 more straight forward solution piping fSerialNumber 21 when calling SetupFill(). Don't relay on the current 22 code! 6 23 7 24 * mhist/MH.h: … … 19 36 * NEWS: 20 37 - updated. 38 39 21 40 22 41 2003/11/14: Abelardo Moralejo … … 28 47 The change consists in the addittion in MF::IsAlNum of ';' as 29 48 a possible alphanumeric character in the string. 49 50 30 51 31 52 2003/11/13: Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r2516 r2519 5 5 multi-telescope files which can be produced with the coming 6 6 camera version 0.7. 7 8 7 9 8 10 *** Version 0.8.2 (2003/11/10) -
trunk/MagicSoft/Mars/mbase/MLog.cc
r2491 r2519 101 101 102 102 #ifdef _REENTRANT 103 // FIXME: Replace Mutex by TMutex 104 #include <pthread.h> 103 #include <TMutex.h> 105 104 #endif 106 105 #include <TGTextView.h> … … 148 147 // Creat drawing semaphore 149 148 // 150 fMuxGui = new pthread_mutex_t; 151 pthread_mutex_init((pthread_mutex_t*)fMuxGui, NULL); 149 fMuxGui = new TMutex; 152 150 #endif 153 151 } … … 158 156 // which is used for the output (i) 159 157 // 160 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), f out(NULL), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)158 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fOut(NULL), fOutAllocated(kFALSE), fGui(NULL), fNumLines(0) 161 159 { 162 160 Init(); … … 168 166 // ofstream as the default output device 169 167 // 170 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), f out(&out), fOutAllocated(kFALSE), fgui(NULL), fNumLines(0)168 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fOut(&out), fOutAllocated(kFALSE), fGui(NULL), fNumLines(0) 171 169 { 172 170 Init(); … … 178 176 // TGTextView as the default output device 179 177 // 180 MLog::MLog(TGTextView &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), f out(NULL), fOutAllocated(kFALSE), fgui(&out), fNumLines(0)178 MLog::MLog(TGTextView &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eGui), fOut(NULL), fOutAllocated(kFALSE), fGui(&out), fNumLines(0) 181 179 { 182 180 Init(); … … 189 187 // or not. 190 188 // 191 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), f gui(NULL), fNumLines(0)189 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGui(NULL), fNumLines(0) 192 190 { 193 191 Init(); … … 205 203 DeallocateFile(); 206 204 #ifdef _REENTRANT 207 pthread_mutex_destroy((pthread_mutex_t*)fMuxGui);205 delete fMuxGui; 208 206 #endif 209 207 } … … 310 308 Output(cerr, len); 311 309 312 if (fDevice&eFile && f out)313 f out->write(fBase, len);314 315 if (fDevice&eGui && f gui)310 if (fDevice&eFile && fOut) 311 fOut->write(fBase, len); 312 313 if (fDevice&eGui && fGui) 316 314 { 317 315 // check whether the current text was flushed or endl'ed … … 348 346 Lock(); 349 347 350 TGText &txt=*f gui->GetText();348 TGText &txt=*fGui->GetText(); 351 349 352 350 // copy lines to TGListBox … … 367 365 368 366 // show last entry 369 f gui->Layout();370 f gui->SetVsbPosition(txt.RowCount()-1);367 fGui->Layout(); 368 fGui->SetVsbPosition(txt.RowCount()-1); 371 369 372 370 // tell a main loop, that list box contents have changed 373 f gui->SetBit(kHasChanged);371 fGui->SetBit(kHasChanged); 374 372 375 373 // release mutex … … 380 378 { 381 379 #ifdef _REENTRANT 382 pthread_mutex_lock((pthread_mutex_t*)fMuxGui);380 fMuxGui->Lock(); 383 381 #endif 384 382 } … … 387 385 { 388 386 #ifdef _REENTRANT 389 pthread_mutex_unlock((pthread_mutex_t*)fMuxGui);387 fMuxGui->UnLock(); 390 388 #endif 391 389 } … … 411 409 cerr.flush(); 412 410 413 if (fDevice&eFile && f out)414 f out->flush();411 if (fDevice&eFile && fOut) 412 fOut->flush(); 415 413 416 414 return 0; … … 455 453 // gcc 3.2: 456 454 char *txt = (char*)"logXXXXXX"; 457 f out = fname ? new ofstream(fname) : new ofstream(/*mkstemp(*/txt/*)*/);455 fOut = fname ? new ofstream(fname) : new ofstream(/*mkstemp(*/txt/*)*/); 458 456 fOutAllocated = kTRUE; 459 457 } … … 467 465 { 468 466 if (fOutAllocated) 469 delete f out;467 delete fOut; 470 468 } 471 469 -
trunk/MagicSoft/Mars/mbase/MLog.h
r2236 r2519 13 13 #define bsz 160 // two standard lines 14 14 15 class TMutex; 15 16 class TGTextView; 16 17 … … 57 58 Bool_t fIsNull; //! Switch output completely off 58 59 59 ofstream *f out; //! possible file output stream60 ofstream *fOut; //! possible file output stream 60 61 Bool_t fOutAllocated; //! flag if fout is created by MLogging 61 TGTextView *f gui; //! Text View output62 TGTextView *fGui; //! Text View output 62 63 63 64 Bool_t fIsDirectGui; //! Pipe text directly to the GUI (for single threaded environments) … … 67 68 68 69 #ifdef _REENTRANT 69 void *fMuxGui;//! Mutex locking access of TGListBox70 TMutex *fMuxGui; //! Mutex locking access of TGListBox 70 71 #endif 71 72 … … 119 120 void SetOutputGui(TGTextView *out, int flag=-1) 120 121 { 121 f gui = out;122 fGui = out; 122 123 CheckFlag(eGui, flag); 123 124 } … … 133 134 // 134 135 DeallocateFile(); 135 f out = &out;136 fOut = &out; 136 137 CheckFlag(eFile, flag); 137 138 } … … 162 163 // I would implement a GetFileName-function, too. 163 164 // 164 if (!f out)165 if (!fOut) 165 166 ReallocateFile(NULL); 166 return *f out;167 return *fOut; 167 168 } 168 169 -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r2493 r2519 894 894 // in the same thread 895 895 // 896 if (fMutex->TryLock() ==13)896 if (fMutex->TryLock()) 897 897 return; 898 898
Note:
See TracChangeset
for help on using the changeset viewer.