Re: Can I create a thread with a runloop and a dispatch queue?
Re: Can I create a thread with a runloop and a dispatch queue?
- Subject: Re: Can I create a thread with a runloop and a dispatch queue?
- From: Daniel DeCovnick <email@hidden>
- Date: Thu, 03 Oct 2013 11:09:45 -0700
You did not miss anything. Since a queue can run on any or multiple threads (except the main queue), creating a runloop on it - and runloops are thread-specific - means that one dispatched block may run on a thread that doesn’t have the runloop created in another by a previously dispatched block.
What are you trying to do?
Daniel
On Oct 3, 2013, at 10:55 AM, Jens Alfke <email@hidden> wrote:
> The main thread of a Cocoa app has a runloop (of course) and also the main GCD dispatch queue. This is very handy because it means tasks on that thread can be scheduled either using the runloop (NSTimer or delayed-perform) or using GCD (dispatch_async, dispatch_sync).
>
> But background threads don’t seem to have the same property. If I create a thread using NSThread, it supports a runloop, but I don’t see any API for getting or creating a dispatch queue that runs in conjunction with the runloop. Did I miss something?
>
> —Jens_______________________________________________
>
> 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
_______________________________________________
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