Maybe a patch a simple as this would do the trick?
// pseudocode in CBLReplication.m
if (some_user_flag_wants_notification_on_main_thread) {
dispatch_async(dispatch_get_main_queue(),^{
// post the notification on the main thread
// which is already running in its own runloop
}
} else {
// just post the notification the normal way on the current thread
// which may or may not be running in its own runloop
}
Would that be reasonable?
- Michael
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).
> >
>
> I'm confused. How is the timer (I assume you mean an NSTimer) firing
> if the thread's not already running its runloop?
>
>
> 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.)
>
>
> —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/1408865200.3007.6.camel%40usa.
For more options, visit https://groups.google.com/d/optout.