IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2007, 10:56:27 AM (19 years ago)
Author:
eugene
Message:

adding intelligent timeouts to task and job threads; removing deprecated files

File:
1 edited

Legend:

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

    r12401 r12404  
    1414void *CheckTasksThread (void *data) {
    1515
     16  float next_timeout;
     17
    1618  gprintInit ();  // each thread needs to init the printing system
    1719  while (1) {
     
    2527    // one run of the task checker
    2628    SerialThreadLock ();
    27     CheckTasks ();
     29    next_timeout = CheckTasks ();
    2830    SerialThreadUnlock ();
    2931    if (VerboseMode() == 2) fprintf (stderr, "T");
    30     // fprintf (stderr, "T");
    31     usleep (1000); // allow other threads a chance to run
     32
     33    next_timeout = MIN (next_timeout, 0.1);
     34    if (next_timeout > 0.001) {
     35      usleep ((int)(1000000*next_timeout)); // allow other threads a chance to run
     36    }     
    3237  }
    3338}
    3439
    35 /* the threaded version of pantasks does not worry about limiting the
    36    time spent in one of the test loops -- comms with the client are
    37    in a separate thread anyway...
    38 */
    39 
    40 int TestElapsedCheck () {
    41   return (FALSE);
    42 }
     40// I sleep for a small amount of time here, based on how long until the next expected
     41// timeout.  this enforces a certain granularity in the task creation, but prevents the task
     42// thread from driving the load up to silly levels.
Note: See TracChangeset for help on using the changeset viewer.