Or if there’s just one operation you need to do in the background, you can use 
just one CBLManager but tell it to run an operation on the shared background 
thread:

/** Asynchronously dispatches a block to run on a background thread. The block 
will be given a
    CBLDatabase instance to use; <em>it must use that database instead of any 
CBL objects that are
    in use on the surrounding code's thread.</em> Otherwise thread-safety will 
be violated, and
    Really Bad Things that are intermittent and hard to debug can happen.
    (Note: Unlike most of the API, this method is thread-safe.) */
- (void) backgroundTellDatabaseNamed: (NSString*)dbName to: (void 
(^)(CBLDatabase*))block;

The only caveat is that this runs on the same thread as replication and 
asynchronous queries, so it will block progress on those till it completes.

—Jens

-- 
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/EA18C932-B78A-43A7-9E07-410B4F90E57E%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to