• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSOperationQueue emptying
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOperationQueue emptying


  • Subject: NSOperationQueue emptying
  • From: "McLaughlin, Michael P." <email@hidden>
  • Date: Thu, 27 Aug 2009 11:18:03 -0400
  • Acceptlanguage: en-US
  • Thread-topic: NSOperationQueue emptying

I'm wondering about the timing of NSOperationQueue emptying.

In my Objective-C++ (Leopard) app, I have one opQueue of operations and the
very last thing each operation does is enqueue the results of a computation
back to the main thread.

NSPointerArray *ptr = [NSPointerArray pointerArrayWithStrongObjects];
[ptr addPointer:&PL];
[mainQueue enqueueNotification:[NSNotification
notificationWithName:@"compNotif"
    object:ptr]
    postingStyle:NSPostNow];
} // end of main()

I use NSPostNow instead of NSPostWhenIdle because the latter never posts!
(reason unknown)  Also, I have garbage collection *required* and do not have
any retain/release statements anywhere.

PL, the output data, is a local std::list [C++ default Ctors/Dtors is
checked.] and the main thread collects these in a list of lists until all
have been collected at which point all NSOperations *should* be finished.

They aren't -- even though I use a separate countdown int as the sentinel.

Each time through the whole process, one operation (not always the same one)
remains in the opQueue, and isFinishd == NO, at the point when the opQueue
is due to be filled up again.  [It is almost always one of the last
operations pushed onto the opQueue.]  If I then
waitUntilAllOperationsAreFinished, the program hangs forever.  Apparently,
this last operation never finishes although the other 1300 operations do and
they are all the same apart from input data.

Question: In Leopard, does an NSOperationQueue send a signal of its own when
an operation is terminating, something analogous to
applicationDidFinishLaunching?  Could garbage collection be postponing the
queue clearing?  I could not find any function that would force clearing the
opQueue.  Is there one?

BTW, I cannot use Snow Leopard for this, at least at work, because I have
only a G5.

--
Mike McLaughlin

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSOperationQueue emptying
      • From: "Adam R. Maxwell" <email@hidden>
  • Prev by Date: NSTableView's delegate dataCellForTableColumn never called
  • Next by Date: Re: Xcode Analyze memory misunderstanding
  • Previous by thread: Re: NSTableView's delegate dataCellForTableColumn never called
  • Next by thread: Re: NSOperationQueue emptying
  • Index(es):
    • Date
    • Thread