On Oct 21, 2014, at 3:15 AM, Rick Mann <rm...@latencyzero.com> wrote:

> I'm using CocoaHTTPServer and RoutingHTTPServer, and when a request comes in, 
> my handler block is called on some arbitrary thread. The run loop associated 
> with it has kCFRunLoopDefaultMode.
> 
> I have code that creates an NSTimer and invokes a block passed to it. This 
> works fine when called from the main thread, but doesn't work when called in 
> the HTTP server handler. So, I tried installing the timer on the current run 
> loop with first common modes and then default mode. In neither case does it 
> fire.
> 
> Any idea what I might be doing wrong?

Arbitrary threads can't be relied upon to run their run loops.  Only the main 
thread and threads which you control (and for which you've written code to 
explicitly run the run loop) can be relied on to do that.

What are you trying to achieve?  What is the timer for?

Is there a reason you can't shunt the creation of the timer to the main thread 
using dispatch_async(dispatch_get_main_queue(), ...)?

Regards,
Ken


_______________________________________________

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