Re: NSRunLoop
Re: NSRunLoop
- Subject: Re: NSRunLoop
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 15 Jun 2010 00:41:14 +0200
Le 15 juin 2010 à 00:22, Ariel Feinerman a écrit :
> Hi,
> I wish to make programme has cpu-related (one thread per core) number of
> worker threads. When user inputs the data, main thread splits up the data
> and send to the workers. Then worker threads go to sleep in anticipation of
> the next chunk of data. How can I do it? I think to NSRunLoop is the best
> way, is the example of code?
>
I guess that if you ask this, you need to deploy on Mac OS 10.5 or older, else instead of bothering with your own thread pool, just use GCD.
If you want to do that for 10.5, use NSOperationQueue.
If you really want to write your own thread pool, there is probably a bunch of sample code on the net. I think you can do that by having all of your thread pooling the same work queue and using a condition to wait works (search for producer/consumer problem in google).
-- Jean-Daniel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >NSRunLoop (From: Ariel Feinerman <email@hidden>) |