Re: How can I get a single threaded network call in ObjC on iOS?
Re: How can I get a single threaded network call in ObjC on iOS?
- Subject: Re: How can I get a single threaded network call in ObjC on iOS?
- From: Jim Adams <email@hidden>
- Date: Thu, 30 Jun 2016 17:00:33 +0000
- Thread-topic: How can I get a single threaded network call in ObjC on iOS?
Just to come back around on this, I ended up using the dispatch_suspend and dispatch_resume method. I had previously explored that but I moved the suspend and resume closer to the network call to make the whole thing simpler. I tried using dispatch_group_enter and dispatch_group_leave but that did not do the same thing.
The idea of a queue of messages to send was something I explored quite a long time ago but I found that it tended to make my code more complex than simpler so I had abandoned that idea.
> On Jun 28, 2016, at 11:50 PM, Alex Zavatone <email@hidden> wrote:
>
> Smarter people that we are have already spent the time to figure it out. Learn the way they did it and profit from their work and experience.
>
> There is a benefit to learning how to create the wheel. That time is not now. Learn the wheel that we have.
>
>
> On Jun 28, 2016, at 7:03 PM, Peter Tomaselli wrote:
>
>> I have not a lot of Cocoa experience here, so I am legitimately asking this question, no snark intended: what’s the advantage to building a home-made “serial” “queue” as opposed to just using an actual serial operation queue? Haven’t you just described the first few steps one would take were one to set out to reimplement NSOperationQueue?
>>
>> FWIW (and as I mentioned, I am an eminently ignorable person when it comes to Cocoa expertise), I sort of see the essence of the “async” flavor of NSOperation as being to provide definitive signaling when an otherwise asynchronous operation is really “finished“ — for whatever business definition of “finished” one requires. So I don’t completely agree that this would be “shoehorning”; seems right on the money to me.
>>
>> Just one opinion! Cheers,
>>
>> Peter
>>
>> On Jun 28, 2016, at 6:50 PM, "Gary L. Wade" <email@hidden> wrote:
>>
>>> Based on his desire to do this serially, he would need a serial queue, and he's using asynchronous requests, so succeeding calls from his completion handler with a simple array in queue pattern is simpler than shoehorning it all into dispatch queues.
>>> --
>>> Gary L. Wade (Sent from my iPhone)
>>> http://www.garywade.com/
>>>
>>>> On Jun 28, 2016, at 3:45 PM, Alex Zavatone <email@hidden> wrote:
>>>>
>>>> Would a dispatch queue get what he's looking for?
>>
>
>
> _______________________________________________
>
> 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