IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 23, 2006, 5:31:41 PM (20 years ago)
Author:
eugene
Message:

cleanup of timeouts and thread-safety issues, controller comms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/pantasks/server_threads.c

    r7960 r8548  
    1313}
    1414
     15/* the threaded version of pantasks does not worry about limiting the
     16   time spent in one of the test loops -- comms with the client are
     17   in a separate thread anyway...
     18*/
     19
     20int TestElapsedCheck () {
     21  return (FALSE);
     22}
     23
    1524/** things related to CheckTasks **/
    1625
     
    2433}
    2534
    26 void CheckTasksThread (void *data) {
     35void *CheckTasksThread (void *data) {
    2736
    2837  gprintInit ();  // each thread needs to init the printing system
     
    3140    // check for thread suspend
    3241    if (!CheckTasksRun) {
    33       usleep (500000);
     42      usleep (100000); // idle if thread action is suspended
    3443      continue;
    3544    }
     
    3847    SerialThreadLock ();
    3948    CheckTasks ();
     49    CheckJobs ();
    4050    SerialThreadUnlock ();
    4151    fprintf (stderr, "T");
    42     usleep (250000);
     52    usleep (10000); // allow other threads a chance to run
    4353  }
    4454}
    4555
     56# if 0
     57// XXX need to harvest jobs on the same thread as they were
     58// spawned.  for the moment, put CheckTasks and CheckJobs in
     59// a single thread.
    4660/** things related to CheckJobs **/
    4761
     
    5569}
    5670
    57 void CheckJobsThread (void *data) {
     71void *CheckJobsThread (void *data) {
    5872
    5973  gprintInit ();  // each thread needs to init the printing system
     
    6276    // check for thread suspend
    6377    if (!CheckJobsRun) {
    64       usleep (500000);
     78      usleep (100000); // idle if thread action is suspended
    6579      continue;
    6680    }
     
    7185    SerialThreadUnlock ();
    7286    fprintf (stderr, "J");
    73     usleep (250000);
     87    usleep (10000); // allow other threads a chance to run
    7488  }
    7589}
     90# endif
    7691
    7792/** things related to CheckController **/
     
    86101}
    87102
    88 void CheckControllerThread (void *data) {
     103void *CheckControllerThread (void *data) {
    89104
    90105  gprintInit ();  // each thread needs to init the printing system
     
    93108    // check for thread suspend
    94109    if (!CheckControllerRun) {
    95       usleep (500000);
     110      usleep (100000); // idle if thread action is suspended
    96111      continue;
    97112    }
     
    103118    SerialThreadUnlock ();
    104119    fprintf (stderr, "C");
    105     usleep (250000);
     120    usleep (10000); // allow other threads a chance to run
    106121  }
    107122}
     
    118133}
    119134
    120 void CheckInputsThread (void *data) {
     135void *CheckInputsThread (void *data) {
    121136
    122137  gprintInit ();  // each thread needs to init the printing system
     
    125140    // check for thread suspend
    126141    if (!CheckInputsRun) {
    127       usleep (500000);
     142      usleep (100000); // idle if thread action is suspended
    128143      continue;
    129144    }
     
    134149    SerialThreadUnlock ();
    135150    fprintf (stderr, "I");
    136     usleep (250000);
     151    usleep (10000); // allow other threads a chance to run
    137152  }
    138153}
Note: See TracChangeset for help on using the changeset viewer.