Thread-topic: How to yield a thread in Carbon these days?
User-agent: Microsoft-Entourage/12.10.0.080409
On Fri, 23 May 2008 23:53:08 -0500, William Bates
<email@hidden> wrote:
> I have a Carbon thread created with MPCreateTask. I need to loop
> inside the thread until something happens, so I want to play nice and
> give up the processor.
> I'm looking for the Carbon equivalent of
> [NSThread sleepUntilDate:(NSDate *)aDate];
> (2) I believe that YieldToThread gives time only to old-style
> "cooperative" threads, not MP threads. Right?
> (3) Calling EventAvail once gave time to other processes. Is it a dead
> issue?
You can use the BSD library functions "sleep", "usleep" or "nanosleep" to
block your MP thread for a given amount of time or use the MPDelayUntil
function to suspend your thread until a specific time.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden