sub threadwork(){ lock(MUTEX); do{ the work; } } $t = new threadpool(42 threads); $t->do( &threadwork() ); lock(MUTEX); loop{ ct = timestamp(); sleep(0.9 seconds); # do a blocking select with timeout in perl fo +r microsecond timings loop {nop;} while (ct==timestamp()); # the spinloop #or, for a interval of 5 seconds: while ( ct+5>timestamp() ); unlock(MUTEX); }
In reply to Re^5: The most precise second (timer)
by misc
in thread The most precise second (timer)
by tukusejssirs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |