> On 21 Oct 2014, at 4:58 pm, Rick Mann <rm...@latencyzero.com> wrote:
> 
> I'm simulating a device that takes a substantial amount of time to respond to 
> a series of REST HTTP request (to support automated testing). I'm writing an 
> OS X app to do this. I was trying to avoid running the timer on the main 
> thread because I don't want the work the timer eventually spawns to get in 
> the way of the main thread's execution. But, I guess that simply means I can  
> dispatch it to another queue that I create? I don't need to serialize 
> individual operations; it would be better if they could run concurrently, if 
> that's how things worked out.
> 
> I guess I could add the timers on the main queue, and when they fire, enqueue 
> their work on some other queue, but that seems to add some overhead to 
> things. (It's negligible in this case, but this doesn't seem like the way to 
> write a high-performance web server).
> 
> -- 

If you’re using blocks anyway you could just use dispatch_after() to schedule 
their execution instead of NSTimers. Then you can target them directly to any 
queue or set of queues you like. 


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to