linux pthread_suspend

Posted by johnnycrash on Stack Overflow See other posts from Stack Overflow or by johnnycrash
Published on 2010-06-08T01:18:31Z Indexed on 2010/06/08 1:22 UTC
Read the original article Hit count: 495

Filed under:
|

Looks like linux doesnt implement pthread_suspend and continue, but I really need em.

I have tried cond_wait, but it is too slow. The work being threaded mostly executes in 50us but occasionally executes upwards of 500ms. The problem with cond_wait is two-fold. The mutex locking is taking comparable times to the micro second executions and I don't need locking. Second, I have many worker threads and I don't really want to make N condition variables when they need to be woken up.

I know exactly which thread is waiting for which work and could just pthread_continue that thread. A thread knows when there is no more work and can easily pthread_suspend itself. This would use no locking, avoid the stampede, and be faster. Problem is....no pthread_suspend or _continue.

Any ideas?

© Stack Overflow or respective owner

Related posts about linux

Related posts about pthreads