Changeset 12404 for trunk/Ohana/src/opihi/pantasks/task_threads.c
- Timestamp:
- Mar 11, 2007, 10:56:27 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/task_threads.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/task_threads.c
r12401 r12404 14 14 void *CheckTasksThread (void *data) { 15 15 16 float next_timeout; 17 16 18 gprintInit (); // each thread needs to init the printing system 17 19 while (1) { … … 25 27 // one run of the task checker 26 28 SerialThreadLock (); 27 CheckTasks ();29 next_timeout = CheckTasks (); 28 30 SerialThreadUnlock (); 29 31 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 } 32 37 } 33 38 } 34 39 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.
