multithreading - Sleeping a PThread other than the one doing the calling -
so have bunch of pthreads, 1 "main" thread , determines if worker thread should running or sleeping. posix definition sleep says the sleep() function shall cause calling thread suspended execution...
obviously clumsy have each worker thread check see if flag set, i'm looking little better. i'm hoping i'm missing obvious, because throwing wrench in plans.
if you're hacking cilk anyway, guess can whatever want
how having each pthread acquire semaphore unit before dequeueing, (or stealing), work object, , releasing after doing work? there may little latency, sure, number of threads available work match number of units signaled semaphore. reduce number of available threads n control thread, wait , acquire n units, choking off n work threads. start 'em again, signal n units.
would work system?
rgds, martin
Comments
Post a Comment