On Sat, 2014-08-23 at 23:16 -0700, Jens Alfke wrote: > > > On Aug 23, 2014, at 10:31 PM, Michael Hines <[email protected]> > > wrote: > > > > It kind of sucks that I have to keep calling the runloop's run() > > function from a timer just to get access to the notifications > > because I'm using this thread for other long-term operations. (Once > > I did that, the notifications started coming back again).
> > If you think about it, you really can't get the notifications without > the runloop. If your thread spends all its time running your own code, > the only way the notification could get called is if it interrupted > your code — at some random CPU instruction — and called into your > handler method. (Which is basically the way Unix signals work, and > everyone agrees that signals are a terrible design and nearly > impossible to handle reliably.) > Is it possible for CBL to use "distributed" notifications? Could we get CBL to post a notification to the distributed notification center and then receive them on the main thread instead of the current thread? If we could do that, then I wouldn't have to use the runloop and those notifications could be processed on another thread that *does* have a runloop? I'm willing to write a patch if you guys think its a reasonable idea.... > > > I'm confused. How is the timer (I assume you mean an NSTimer) firing if the thread's not already running its runloop? > > I misspoke - my background thread code just times out and checks the runloop to see if there's anything available to be proceseed after a "timeout" and then goes back about its business. But that's kind of wasteful. > > —Jens > -- > You received this message because you are subscribed to a topic in the > Google Groups "Couchbase Mobile" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/mobile-couchbase/uF-jSiLbre8/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mobile-couchbase/CB48DFD7-E69D-4087-BA8B-07A30A2A0BA2%40couchbase.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/1408863739.3007.3.camel%40usa. For more options, visit https://groups.google.com/d/optout.
