Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: How to yield a thread in Carbon these days?



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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.