[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem allocating an NSOperationQueue
From: |
Richard Frith-Macdonald |
Subject: |
Re: Problem allocating an NSOperationQueue |
Date: |
Tue, 7 Jan 2014 16:26:12 +0000 |
On 7 Jan 2014, at 14:52, "Lobron, David" <dlobron@akamai.com> wrote:
> Hi Fred,
>
> Thank you for your fast reply.
<snip>
> The hang occurs on the line where I set firstOpQueue to the result of
> "[[NSOperationQueue new] autorelease]".
I can't tell for sure but I suspect perhaps you are creating the queue in a
different thread from the main one?
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).
You could try the new code (svn trunk) and see if it fixes your problem.