Re: Synchronizing tsleep() and wakeup()
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Aug 2, 2004, at 12:54 PM, Eric Long wrote:
Hi,
Which says:
The BSD portion of Mac OS X provides tsleep, wakeup, and wakeup_one,
which are
equivalent to condition variables with the addition of an optional
time-out.
Since they are more commonly used for waiting a predetermined period
of time,
these calls are discussed in more detail in the section 3Using
tsleep2 as part
of the 3Miscellaneous Kernel Services2 chapter.
In my case, I'm not waiting for a predetermined amount of time. In
fact, I
may not need to wait at all, if the other thread has changed the
value, and
ultimately I only want to sleep until the value has changed or we
time-out
and give up waiting for the change.
What's the best way to do this in the kernel?
Sounds like you want Mach semaphores. Check out <mach/semaphore.h> in the Kernel framework. Specifically: semaphore_wait() semaphore_timedwait() semaphore_signal() HTH. Brian Bergstrand <http://www.bergstrand.org/brian/>, AIM: triryche206 PGP Key: <http://www.bergstrand.org/brian/misc/public_key.txt> Let the chips fall where they may, but when the alcohol wears off tomorrow there's going to be one hell of a mess to clean up. - David Muench As of 01:49:22 PM, iTunes is playing "For The Love Of God" from "Passion And Warfare" by "Steve Vai" -----BEGIN PGP SIGNATURE----- Version: PGP 8.1 iQA/AwUBQQ5/m3nR2Fu2x7aiEQI+CwCgzT95NmNzIRLGY7/1f5KZ0jH1e3sAoK4o y7D/P1JgDaSGZ7teaLGQuTUo =SmHG -----END PGP SIGNATURE----- _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.
participants (1)
-
Brian Bergstrand