site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com client_1_thread : ----------------------- loop { semaphore_wait(client_1_sem) .... do_some_process(...) .... semaphore_signal(client_2_sem) } client_2_thread : ----------------------- loop { semaphore_wait(client_2_sem) .... do_some_process(...) .... semaphore_signal(client_3_sem) } .... third client server_thread : -------------------- loop { semaphore_signal(client_1_sem) wait_some_time() } Thanks in advance Stephane Letz _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... We are using semaphores (the mach API defined in <mach/semaphore.h> ) to synchronize threads in different process in a server/client system. The server signal a first client, that does some processing, then the first client signal a second client, and so on : The server_thread does not synchronize on client processing end but runs at a periodic rate. In normal situation all clients are supposed to run in the server period. If clients are late, they are cases where the semaphore get signaled several times before the waiting thread get actually waken up. When the thread finally wakes up, it is able to "catch up" by running several cycles up to the point the client input semaphore blocks again. This is generally fine, but in some cases, we have to consider that a client is really too late and we would like to "reset" its input semaphore (actually loosing all pending signals that where accumulated from the previous component in the chain, the server of another client) Is there a way to "flush/reset" a semaphore to have to desired behaviour? This email sent to site_archiver@lists.apple.com
participants (1)
-
Stéphane Letz