Changeset 2492 in Sophya for trunk/SophyaPI/PIext/pistdimgapp.cc
- Timestamp:
- Jan 6, 2004, 6:05:25 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pistdimgapp.cc
r2491 r2492 2 2 #include <stdlib.h> 3 3 #include <stdio.h> 4 #include <unistd.h> 4 5 #include <string.h> 5 6 … … 406 407 { 407 408 while (!_fgstop) { 408 usleep( 1000);409 usleep(2000); 409 410 _app->getMutex().broadcast(); 410 411 } … … 443 444 444 445 thr_glsyn.lock(); // <ZThread> 445 //D BG int klp = 0;446 //DEL-DBG int klp = 0; 446 447 while (mStop) { 447 448 fg_glsynlock = true; … … 451 452 XtDispatchEvent(&evt); 452 453 nevtproc++; 453 if (nevtproc >= 50) break;454 if (nevtproc >= 200) break; 454 455 } 455 456 fg_glsynlock = false; 457 //DBG cout << " "DBG-Run:: Going to wait ... " << klp << endl; 456 458 thr_glsyn.wait(); // <ZThread> 457 // 459 //DBG cout << "DBG-Run:: Out of wait " << ++klp << endl; 458 460 // usleep(1000); 459 461 } … … 626 628 } 627 629 630 class SyncPIS { 631 public: 632 explicit SyncPIS(ZMutex & mtx, bool fglock=true, int sigbr=0) 633 { 634 _mtx = &mtx; _sigbr = sigbr; 635 _fglock = fglock; 636 if (_fglock) mtx.lock(); 637 } 638 ~SyncPIS() 639 { 640 if (_fglock && (_mtx != NULL) ) { 641 if (_sigbr == 1) _mtx->signal(); 642 else if (_sigbr == 2) _mtx->broadcast(); 643 _mtx->unlock(); 644 } 645 } 646 647 private: 648 ZMutex * _mtx; 649 int _sigbr; 650 bool _fglock; 651 inline SyncPIS() {_mtx = NULL; _sigbr = 0; _fglock = false; } 652 }; 653 628 654 629 655 /* --Methode-- */ … … 656 682 657 683 // <ZThread> global PIApplication event loop synchronisation 658 if (fglock) ZSync zs(thr_glsyn, 2); 684 SyncPIS zs(getMutex(), fglock, 2); 659 685 660 686 // Choix de la taille de fenetre … … 726 752 727 753 // <ZThread> global PIApplication event loop synchronisation 728 if (fglock) ZSync zs(thr_glsyn, 2); 754 SyncPIS zs(getMutex(), fglock, 2); 729 755 730 756 // Trace en superpoistion … … 830 856 831 857 // <ZThread> global PIApplication event loop synchronisation 832 if (fglock) ZSync zs(thr_glsyn, 2); 858 SyncPIS zs(getMutex(), fglock, 2); 833 859 834 860 // Trace en superpoistion
Note:
See TracChangeset
for help on using the changeset viewer.