Changeset 2486 in Sophya for trunk/SophyaPI/PIext/piacmd.cc


Ignore:
Timestamp:
Dec 26, 2003, 12:17:41 PM (22 years ago)
Author:
ansari
Message:

Debut d'implementation piapp multi-thread - (avec des pb lors de l'execution de demo.pic) Reza 26 Dec 2003

File:
1 edited

Legend:

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

    r2474 r2486  
    180180
    181181InitializeHelpWindowMenu();
     182// <ZThread>  Thread control attributes
     183fg_thrstop = false;
     184fg_threxe = false;
    182185}
    183186
     
    195198}
    196199
     200
     201/* --Methode-- */
     202void PIACmd::AddInputLine(string const & line)
     203{
     204  mutx_inps.lock();
     205  inputlines.push(line);
     206  mutx_inps.unlock();
     207  mutx_inps.broadcast();
     208}
     209
     210/* --Methode-- */
     211void PIACmd::StopThread()
     212{
     213  fg_thrstop = true;
     214  mutx_inps.broadcast();
     215}
     216
     217/* --Methode-- */
     218void PIACmd::run()
     219{
     220  cout << " DBG-PIACmd::run() -- DEBUT " << endl;
     221  while (!fg_thrstop) {
     222    mutx_inps.lock();
     223    while (inputlines.empty()) {
     224      fg_threxe = false;
     225      mutx_inps.wait();
     226    }
     227    string line = inputlines.top();
     228    inputlines.pop();
     229    fg_threxe = true;
     230    mutx_inps.unlock();
     231    Interpret(line);
     232  }
     233}
    197234
    198235/* --Methode-- */
Note: See TracChangeset for help on using the changeset viewer.