c - Signal counter while waiting on condition variable -
does condition variable have number - number of times has been signaled associated (like semaphore)? i.e., if 5 threads signal condition variable, , assuming of them canceled, possible condition variable waited on 5 other threads, afterwards? or, 1 thread unblock after calling wait?
if 5 threads signal condition variable, , assuming of them canceled, possible condition variable waited on 5 other threads, afterwards?
although language , implementation specific, typically answer there not number. if condition signalled without there being threads waiting on condition signals lost. if 5 signals generated , thread waits on condition, has wait next signal delivered.
now question c (i assume posix threads) can add details pthread_cond_signal()
manual:
the pthread_cond_broadcast() , pthread_cond_signal() functions shall have no effect if there no threads blocked on cond.
there no counter keeps track of posix condition signals.
Comments
Post a Comment