Also as far as I can tell the app should be running on the main thread with the exception of the CBL communication. In *AppDelegate* I set:
*CBLManager.sharedInstance.dispatchQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);* Then every time I want to talk with the database I do something like this: *dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{* * // CBL Communication here* *});* Is there anything wrong with this approach? It seems to work fine on the device. I'm just encountering the problem above when trying to get the Kiwi Unit Tests to work. On Wednesday, April 2, 2014 12:43:24 PM UTC-7, David Quon wrote: > > Hi Jens. So I put a breakpoint in the block above on *properties = > self.propertiesToSave;* and output the following. > > *(lldb) po dispatch_get_current_queue()* > *<OS_dispatch_queue_root: com.apple.root.default-priority[0x4946100] = { > xrefcnt = 0x80000000, refcnt = 0x80000000, suspend_cnt = 0x0, locked = 1, > target = [0x0], width = 0x7fffffff, running = 0x2, barrier = 0 }>* > > *(lldb) po CBLManager.sharedInstance.dispatchQueue* > *<OS_dispatch_queue_root: com.apple.root.default-priority[0x4946100] = { > xrefcnt = 0x80000000, refcnt = 0x80000000, suspend_cnt = 0x0, locked = 1, > target = [0x0], width = 0x7fffffff, running = 0x2, barrier = 0 }>* > > So I'm a little confused why the test *ok = dispatch_get_current_queue() > == dispatchQueue;* in *beginUse* would fail. Do you have any thoughts of > what else I could be doing incorrectly to cause this assertion? > > On Wednesday, April 2, 2014 9:41:47 AM UTC-7, David Quon wrote: >> >> > Well, if you call dispatch_sync from the same dispatch queue you’re >> dispatching to, you’ll deadlock. For example, if you’re on the main thread >> and try to dispatch to the main thread. That might be what’s happening. >> >> Ah that must be exactly what's happening as it does deadlock. So I guess >> that's out as a solution. My next steps I guess are to investigate how >> Kiwi handles threading and why it differs from running the app on the >> device. Thanks Jens for the advice. >> >> On Tuesday, April 1, 2014 7:22:07 PM UTC-7, Jens Alfke wrote: >>> >>> >>> On Apr 1, 2014, at 6:00 PM, David Quon <dav...@amcoonline.net> wrote: >>> >>> > I tried changing the thread to be the main thread if running Kiwi Unit >>> Tests and a DB thread if running the app on the device. However for >>> whatever reason this just froze the app when trying to get started to run >>> the Unit Tests (not yet running any tests). >>> >>> Well, if you call dispatch_sync from the same dispatch queue you’re >>> dispatching to, you’ll deadlock. For example, if you’re on the main thread >>> and try to dispatch to the main thread. That might be what’s happening. >>> >>> —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 mobile-couchbase+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/8f9b04e8-c621-48ee-a006-4e950c33c694%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.