Re: Help with threads and queues
Re: Help with threads and queues
- Subject: Re: Help with threads and queues
- From: Paul Franz <email@hidden>
- Date: Thu, 29 Apr 2010 17:41:12 -0400
Do you know if it is available on the iPad? I think it is because
according the Mac Rumors website says so. This is a back end code for
a online board game and I am trying to port it over to the iPad. I
figured the back end is the best place to start (i.e. avoid UI at the
moment which will be a total re-write).
Now if we assume that it is. The code goes from having a thread that
pulls the data of the queue and pushing over the Internet. To a
dispatch queue that calls a function that sends the data.
Questions:
1) If the connection fails, can I suspend the processing of items on
the queue from within the block?
2) Is there anyway to peek at the queue and find out how many
"tasks" are queued up?
3) Is there a Cocoa wrapper for the dispatch code or will I need to
create my own?
4) Do the dispatch queues work with Garbage Collection compiled code?
Paul Franz
On Thu, Apr 29, 2010 at 1:20 PM, Dave DeLong <email@hidden> wrote:
> Whoops, that should've been dispatch_async and not dispatch_queue_async.
>
> Silly typing code in an email window...
>
> Dave
>
> On Apr 29, 2010, at 10:26 AM, Dave DeLong wrote:
>
>> #import <dispatch/dispatch.h>
>>
>> //somewhere reasonably accessible to your producer:
>> dispatch_queue_t mySerialQueue = dispatch_queue_create("franz.p.paul.myserialqueue", NULL);
>>
>> //in your producer:
>> id newResource = ....; // the thing you want to notifyAll() about
>> dispatch_queue_async(mySerialQueue, ^{
>> /**
>> do something with newResource here.
>> this could mean putting your consumer code in here, or passing the resource off to another object, etc
>> **/
>> });
>>
>> //when you're done producing:
>> dispatch_release(mySerialQueue);
>
> _______________________________________________
>
> 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