site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Fri, Sep 11, 2009 at 6:44 AM, Eric Long <ericsmac@smithmicro.com> wrote:
I have a kext that sends data to a daemon via an IODataQueue. The daemon processes the data and sends back a response to my IOUserClient.
The thread that enqueues the data must have the response or time-out before continuing. The response obviously comes on a separate thread.
Ideally, the enque thread will go to sleep and be woken up by the response handler. The problem is there is a window for a race condition between when the enque thread is actually asleep and when the response arrives and the handler wants to wake it up. This leaves the potential that the thread is not asleep and therefore not ready to be woken up.
The thread primitives that might allow me to check if the thread is sleeping are not exposed in the kpi.
Anyone with advice on how to reconcile this?
Look at IOLockSleep and IOLockWakeup. You want code like this: IOLockLock(lock); while (!condition) _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
Chris Suter