Changeset 2494 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Jan 6, 2004, 7:44:56 PM (22 years ago)
Author:
ansari
Message:

Suite debugging gestion lock entre threads ds piapp - A l'air de

marcher sur OSF1 et Linux ... Reza 06/01/2004

Location:
trunk/SophyaPI/PIext
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r2465 r2494  
    6666  nx = ny = 1;
    6767  nx = atoi(tokens[0].c_str());    ny = atoi(tokens[1].c_str());
    68   if (mImgApp) mImgApp->SetZone(nx, ny);
    69   } 
     68  if (mImgApp) {
     69    mImgApp->LockMutex();  // <ZThread> global event loop synchronisation
     70    mImgApp->SetZone(nx, ny);
     71    mImgApp->UnlockMutex(true);  // <ZThread> global event loop synchronisation
     72  }
     73
    7074else if (kw == "newwin") {
    7175  int nx=1, ny=1;
     
    7882    sy = atoi(tokens[3].c_str());
    7983  }
    80   if (mImgApp) mImgApp->CreateGraphWin(nx, ny, sx, sy);
     84  if (mImgApp) {
     85    mImgApp->LockMutex();   // <ZThread> global event loop synchronisation
     86    mImgApp->CreateGraphWin(nx, ny, sx, sy);
     87    mImgApp->UnlockMutex(true); // <ZThread> global event loop synchronisation
     88  }
    8189
    82 else if (kw == "stacknext") mImgApp->StackWinNext();
     90else if (kw == "stacknext") {
     91  mImgApp->LockMutex();  // <ZThread> global event loop synchronisation
     92  mImgApp->StackWinNext();
     93  mImgApp->UnlockMutex(true);  // <ZThread> global event loop synchronisation
     94}
    8395else if (kw == "graphicatt") {
    8496  if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl;  return(0); }
     
    296308// utilise donc des DlFunction  (Reza 20/08/98)  voir commentaire ds .h (pb g++)
    297309  DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
     310/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
    298311//   On redirige la sortie sur le terminal
    299312  bool red = mImgApp->HasRedirectedStdOutErr();
    300313  mImgApp->RedirectStdOutErr(false);
     314                                    --------DEL  */
    301315#ifdef SANS_EVOLPLANCK
    302316  TRY {
     
    326340  }
    327341#endif
     342/*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
    328343  mImgApp->RedirectStdOutErr(red);
     344                                    --------DEL    */
    329345}
    330346
  • trunk/SophyaPI/PIext/piacmd.cc

    r2490 r2494  
    218218void PIACmd::run()
    219219{
    220   cout << " DBG-PIACmd::run() -- DEBUT " << endl;
    221220  while (!fg_thrstop) {
    222221    mutx_inps.lock();
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r2492 r2494  
    408408    while (!_fgstop) {
    409409      usleep(2000);
    410       _app->getMutex().broadcast();
     410      _app->LockMutex();
     411      bool fgb = false;
     412      if (_app->CheckPendingEvents() != 0)  fgb = true;
     413      _app->UnlockMutex(fgb);
    411414    }
    412415  }
     
    415418  bool _fgstop;
    416419};
     420
     421int PIStdImgApp::CheckPendingEvents()
     422{
     423  return XtAppPending(*_appctx);
     424}
     425
    417426/* --Methode-- */
    418427void PIStdImgApp::Run()
     
    421430int szx, szy, szf;
    422431XtAppContext * appctx = PIXtAppCtx(szx, szy, szf);
     432_appctx = appctx;   // Pour CheckPendingEvents()
    423433// Pour appeler FinishCreate() des objets dans la fenetre principale
    424434if (mStop) { // C'est la premiere fois
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r2492 r2494  
    6060     inline void       LockMutex() { thr_glsyn.lock(); }
    6161     inline void       UnlockMutex(bool fgbr=false)
    62         { thr_glsyn.broadcast(); thr_glsyn.unlock(); }
     62        { if (fgbr) thr_glsyn.broadcast(); thr_glsyn.unlock(); }
    6363     inline bool       isGlSyncLocked() { return fg_glsynlock; }
     64     int               CheckPendingEvents();
    6465
    6566  // Methodes d'Affichage generique
     
    240241    ZMutex thr_glsyn;
    241242    bool fg_glsynlock;  // true: thr_glsyn locke pour traitement evts
     243    XtAppContext * _appctx; // Pour CheckPendingEvents()  $CHECK$ A supprimer si possible ...
    242244};
    243245
  • trunk/SophyaPI/PIext/servnobjm.cc

    r2491 r2494  
    441441  return;
    442442  }
    443 nt->Show();
    444 nt->Print(0,10);
     443//DBG nt->Show();
     444//DBG nt->Print(0,10);
    445445PINTuple3D* pin = new PINTuple3D(nt, true);
    446446pin->SelectXYZ(ntn[0], ntn[1], ntn[2]);
Note: See TracChangeset for help on using the changeset viewer.