[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem allocating an NSOperationQueue

From: Lobron, David
Subject: Re: Problem allocating an NSOperationQueue
Date: Tue, 7 Jan 2014 13:19:37 -0500
User-agent: Microsoft-MacOutlook/

>I can't tell for sure but I suspect perhaps you are creating the queue in
>a different thread from the main one?

Yes, indeed!

>At any rate it sounds like a thread deadlock issue (hard to track down
>because different objc runtimes have different locking behaviors when
>initialising classes).
>The current released implementation creates the main queue when the class
>is initialised (it seems to need to do this for OSX compatibility), and
>does so in the main thread.
>That means that if yoiu first use the class in a thread other than the
>main one, it internally asks the main thread to create the main queue
>before anythign else will happen.
>Given the runtime oddities, it's probably not a good idea to do it in the
>main thread rather than the current thread, and I've restructured the
>code a little to avoid explicitly using the main thread (ie the thread
>first using the class should be able to create the main quueu itsself).

I tried moving my allocation to the main thread, and that fixed the
problem.  Thank you for your help here!

>You could try the new code (svn trunk) and see if it fixes your problem.

I might just try that, since I'd rather keep my code as it is if possible.

Thank you again,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]