Re: NSOperationQueue and for-loop

2012-10-03 Thread Mike Abdullah
On 3 Oct 2012, at 14:17, Koen van der Drift wrote: > On Wed, Oct 3, 2012 at 9:03 AM, Koen van der Drift > wrote: > Good point, thanks. So are there any workarounds for that? I'm sure >> this pattern (doing lots of calculations concurrently, and store the >> results in a common object for later)

Re: NSOperationQueue and for-loop

2012-10-03 Thread Koen van der Drift
On Wed, Oct 3, 2012 at 9:03 AM, Koen van der Drift wrote: Good point, thanks. So are there any workarounds for that? I'm sure > this pattern (doing lots of calculations concurrently, and store the > results in a common object for later), is used in other situations as > well. >From a quick search

Re: NSOperationQueue and for-loop

2012-10-03 Thread Koen van der Drift
On Wed, Oct 3, 2012 at 8:48 AM, Mike Abdullah wrote: > Regardless, your posted code is going to blow up sooner or later. NSMutableArray is not safe to modify from more than a single thread at a time. If two of your worker blocks happen to finish at the same time and call -addObject: together, nast

Re: NSOperationQueue and for-loop

2012-10-03 Thread Mike Abdullah
On 3 Oct 2012, at 13:37, Koen van der Drift wrote: > On Tue, Oct 2, 2012 at 10:30 PM, Koen van der Drift > wrote: > >>> Thanks, I'll Google for some examples. For now, I still get an >>> EXC_BAD_ACCESS (code=13, address = 0x0) error in one of the threads after >>> several iterations. Some mo

Re: NSOperationQueue and for-loop

2012-10-03 Thread Koen van der Drift
On Tue, Oct 2, 2012 at 10:30 PM, Koen van der Drift wrote: >> Thanks, I'll Google for some examples. For now, I still get an >> EXC_BAD_ACCESS (code=13, address = 0x0) error in one of the threads after >> several iterations. Some more digging reveals:*** -[MyObject setPosition:]: >> message se

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 9:21 PM, davel...@mac.com wrote: > Only variables that are being modified by the block need to be declared with > the __block specifier. You shouldn't be declaring the underlying instance > variables as __block. You can mix and match ARC and non-ARC code. Google > should hel

Re: NSOperationQueue and for-loop

2012-10-02 Thread davelist
On Oct 2, 2012, at 8:43 PM, Koen van der Drift wrote: > > On Oct 2, 2012, at 6:19 PM, Koen van der Drift > wrote: > >> >> On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: >> >>> I can't speak to the other examples since I haven't seen them, but the >>> __block specifier is necessary i

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 6:19 PM, Koen van der Drift wrote: > > On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: > >> I can't speak to the other examples since I haven't seen them, but the >> __block specifier is necessary if your block modifies the variable (your >> block does modify i). Your

Re: NSOperationQueue and for-loop

2012-10-02 Thread Koen van der Drift
On Oct 2, 2012, at 6:07 PM, davel...@mac.com wrote: > I can't speak to the other examples since I haven't seen them, but the > __block specifier is necessary if your block modifies the variable (your > block does modify i). Your example also seems a bit strange since your for > loop modifies i

Re: NSOperationQueue and for-loop

2012-10-02 Thread davelist
On Oct 2, 2012, at 5:49 PM, Koen van der Drift wrote: > Hi, > > When looking how to implement an NSOperationQueue with a loop, I found > several examples that have the following structure: > > NSInteger i; > >for ( i = 0; i < 1000; i++ ) { >[queue addOpera

Re: NSOperationQueue

2012-06-03 Thread Graham Cox
On 03/06/2012, at 5:29 PM, Charles Srstka wrote: > Since you’ve evidently already figured out a way to determine what images are > visible in the view, just set up an NSMapTable or an NSDictionary mapping > image URLs to operations, and then you know which operations correspond to > the visibl

Re: NSOperationQueue

2012-06-03 Thread Charles Srstka
On Jun 3, 2012, at 1:23 AM, Graham Cox wrote: > define "the visible objects" when what you have at hand is not a visual > object at all, but an object whose job is to make an image from some data. I’ll go with whatever you meant when you said: On Jun 2, 2012, at 12:34 AM, Graham Cox wrote: >

Re: NSOperationQueue

2012-06-03 Thread Graham Cox
On 03/06/2012, at 4:54 PM, Kyle Sluder wrote: > If IKImageView's architecture is proving to be a problem, perhaps it's time > to consider ditching IKImageView. I'm certainly going to give that some serious thought. In fact my scheme is now working fairly well, at least when I run it from Xcod

Re: NSOperationQueue

2012-06-02 Thread Kyle Sluder
On Jun 2, 2012, at 11:23 PM, Graham Cox wrote: > > define "the visible objects" when what you have at hand is not a visual > object at all, but an object whose job is to make an image from some data If IKImageView's architecture is proving to be a problem, perhaps it's time to consider ditchi

Re: NSOperationQueue

2012-06-02 Thread Graham Cox
On 03/06/2012, at 4:13 PM, Charles Srstka wrote: > On Jun 2, 2012, at 8:16 PM, Graham Cox wrote: > >> The problem is not that setting the priority of an operation doesn't work, >> it's that manipulating the priority based on what is visible at a given >> moment is hard. > > How is it hard? Yo

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 2, 2012, at 8:16 PM, Graham Cox wrote: > The problem is not that setting the priority of an operation doesn't work, > it's that manipulating the priority based on what is visible at a given > moment is hard. How is it hard? You just call setQueuePriority: on the operations for the visib

Re: NSOperationQueue

2012-06-02 Thread Graham Cox
On 03/06/2012, at 3:03 AM, Ken Thomases wrote: > That said, I don't know that OP requires strict LIFO order. He just wants > the operations associated with images which are scrolled into view to have > higher priority than those which aren't. That can just be accomplished by > setting the pr

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 2, 2012, at 12:32 PM, Markus Spoettl wrote: >> Who said anything about order? > > The OP did: > >> Is there a way to add operations to the queue so that they "jump the queue" >> ahead of any operations that are not running and have not been run yet? That statement isn’t expressing a des

Re: NSOperationQueue

2012-06-02 Thread Markus Spoettl
On 6/2/12 7:27 PM, Kyle Sluder wrote: On Jun 2, 2012, at 9:54 AM, Markus Spoettl wrote: I'm still not seeing how queuePriority would solve the issue. Say you have a queue with maxConcurrentOperationCount == 1 OP expressed his desire to have a queue with maxConcurrentOperationCount> 1. W

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 2, 2012, at 11:54 AM, Markus Spoettl wrote: > I'm still not seeing how queuePriority would solve the issue. Say you have a > queue with maxConcurrentOperationCount == 1 > > 1) You add operation (A), it starts executing > > 2) You add operation (B), (C), (D), (E), (F), (G), (H) and (I) in

Re: NSOperationQueue

2012-06-02 Thread Kyle Sluder
On Jun 2, 2012, at 9:54 AM, Markus Spoettl wrote: > > I'm still not seeing how queuePriority would solve the issue. Say you have a > queue with maxConcurrentOperationCount == 1 OP expressed his desire to have a queue with maxConcurrentOperationCount > 1. > > Please explain how you suggest to

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 2, 2012, at 11:54 AM, Markus Spoettl wrote: > I'm still not seeing how queuePriority would solve the issue. Say you have a > queue with maxConcurrentOperationCount == 1 > > 1) You add operation (A), it starts executing > > 2) You add operation (B), (C), (D), (E), (F), (G), (H) and (I) in

Re: NSOperationQueue

2012-06-02 Thread Ken Thomases
On Jun 2, 2012, at 11:54 AM, Markus Spoettl wrote: > I'm still not seeing how queuePriority would solve the issue. Say you have a > queue with maxConcurrentOperationCount == 1 > > 1) You add operation (A), it starts executing > > 2) You add operation (B), (C), (D), (E), (F), (G), (H) and (I) in

Re: NSOperationQueue

2012-06-02 Thread Markus Spoettl
On 6/2/12 5:55 PM, Kyle Sluder wrote: On Jun 2, 2012, at 8:38 AM, Markus Spoettl wrote: On 6/2/12 4:57 PM, Charles Srstka wrote: On Jun 1, 2012, at 10:23 PM, Graham Cox wrote: On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: Give them a higher priority. You should be able to alter the priori

Re: NSOperationQueue

2012-06-02 Thread Kyle Sluder
On Jun 2, 2012, at 9:04 AM, Charles Srstka wrote: > > It’s even easier than that, since there’s no need to de-prioritize anything. > You just have everything’s priority set to NSOperationQueuePriorityNormal at > the time of enqueuing, and give NSOperationQueuePriorityHigh or > NSOperationQueu

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 2, 2012, at 10:55 AM, Kyle Sluder wrote: > On Jun 2, 2012, at 8:38 AM, Markus Spoettl wrote: > >> On 6/2/12 4:57 PM, Charles Srstka wrote: >>> On Jun 1, 2012, at 10:23 PM, Graham Cox wrote: >>> On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: > Give them a higher priority. Yo

Re: NSOperationQueue

2012-06-02 Thread Kyle Sluder
On Jun 2, 2012, at 8:38 AM, Markus Spoettl wrote: > On 6/2/12 4:57 PM, Charles Srstka wrote: >> On Jun 1, 2012, at 10:23 PM, Graham Cox wrote: >> >>> On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: >>> Give them a higher priority. You should be able to alter the priorities as the user

Re: NSOperationQueue

2012-06-02 Thread Markus Spoettl
On 6/2/12 4:57 PM, Charles Srstka wrote: On Jun 1, 2012, at 10:23 PM, Graham Cox wrote: On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: Give them a higher priority. You should be able to alter the priorities as the user scrolls, and NSOperationQueue will do the right thing. I tried this but

Re: NSOperationQueue

2012-06-02 Thread Charles Srstka
On Jun 1, 2012, at 10:23 PM, Graham Cox wrote: > On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: > >> Give them a higher priority. You should be able to alter the priorities as >> the user scrolls, and NSOperationQueue will do the right thing. > > > I tried this but it doesn't work - a bit of th

Re: NSOperationQueue

2012-06-01 Thread Graham Cox
On 02/06/2012, at 2:36 PM, Julius Oklamcak wrote: > Potentially you could end up queuing up hundreds (or thousands) of thumbnail > generation requests (depending on how many SVG files the user has). If the > user was to close the browser to do something else, or switch to another > app, you would

RE: NSOperationQueue

2012-06-01 Thread Julius Oklamcak
>> At the moment that the operations are queued, there are some operations in the queue not yet run, and some running. The code that creates the operations doesn't know which ones are needed more urgently (the latest ones), so it can only assign a high priority to all of them, so they all end up wi

Re: NSOperationQueue

2012-06-01 Thread Kyle Sluder
On Jun 1, 2012, at 8:23 PM, Graham Cox wrote: > > On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: > >> Give them a higher priority. You should be able to alter the priorities as >> the user scrolls, and NSOperationQueue will do the right thing. > > > I tried this but it doesn't work - a bit of

Re: NSOperationQueue

2012-06-01 Thread Graham Cox
On 02/06/2012, at 1:12 PM, Kyle Sluder wrote: > Give them a higher priority. You should be able to alter the priorities as > the user scrolls, and NSOperationQueue will do the right thing. I tried this but it doesn't work - a bit of thought about how the ops are queued will show why no meanin

Re: NSOperationQueue

2012-06-01 Thread Kyle Sluder
On Jun 1, 2012, at 8:07 PM, Graham Cox wrote: > A question about NSOperationQueue: > > Is there a way to add operations to the queue so that they "jump the queue" > ahead of any operations that are not running and have not been run yet? Give them a higher priority. You should be able to alter

Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:

2011-10-01 Thread Kyle Sluder
On Sat, Oct 1, 2011 at 3:44 PM, Quincey Morris wrote: > > Aren't you missing a [replyQueue setSuspended: NO] in there somewhere? And > if you do that, aren't you then failing to wait for backgroundQueue to > empty? Yes, sorry. The call to -setSuspended: happens right before -waitUntilAllOperation

Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:

2011-10-01 Thread Stevo Brock
What about removing replyQueue altogether, have the background operation add it's result processing back into backgroundQueue and just wait on backgroundQueue to finish? -Stevo On Oct 1, 2011, at 3:44 PM, Quincey Morris wrote: > On Oct 1, 2011, at 15:06 , Kyle Sluder wrote: > >> NSOperationQ

Re: NSOperationQueue: -waitUntilAllOperationsAreFinished and -setSuspended:

2011-10-01 Thread Quincey Morris
On Oct 1, 2011, at 15:06 , Kyle Sluder wrote: > NSOperationQueue backgroundQueue = /* some long-lived background queue */; > NSOperationQueue replyQueue = [NSOperationQueue new]; > int totalResult = 0; > > [replyQueue setSuspended:YES]; > > for (id foo in myFoos) { > [backgroundQueue addOperati

Re: NSOperationQueue and Synchronization Control

2011-05-06 Thread Nick
Read this http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html Specifically this should answer your question: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html%23//app

Re: NSOperationQueue and Synchronization Control

2011-05-06 Thread Matt Neuburg
On Sat, 07 May 2011 03:32:37 +0800, Bing Li said: >Dear all, > >I am a new Cocoa developer on iPhone/iPad. I plan to use NSOperationQueue to >achieve the goal of concurrency. I am not sure if it is better since I also >know GCD is available. > >Moreover, I didn't notice that Cocoa provided develop

Re: NSOperationQueue and Synchronization Control

2011-05-06 Thread Sean McBride
On Sat, 7 May 2011 03:32:37 +0800, Bing Li said: >I am a new Cocoa developer on iPhone/iPad. I plan to use NSOperationQueue to >achieve the goal of concurrency. I am not sure if it is better since I also >know GCD is available. > >Moreover, I didn't notice that Cocoa provided developers with >sync

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Jerry Krinock
OK, I submitted some Document Feedback on -cancelAllOperations, referring to this thread in the list archives and complaining that the statement "Queued operations are cancelled before they begin executing" seems to be an oversimplification. And I was able to solve my deadlock with -waitUntilAl

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Ken Thomases
On Mar 31, 2010, at 5:03 PM, Jerry Krinock wrote: > So Ken I believe you're saying that the "cancelled" operations become ready > to run immediately, which they do (as no-ops), which removes them from the > queue. In *effect* therefore, "are cancelled before they begin executing" > *does indee

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Jerry Krinock
On 2010 Mar 31, at 15:03, Jerry Krinock wrote: > So Ken I believe you're saying that the "cancelled" operations become ready > to run immediately, which they do (as no-ops), which removes them from the > queue. In *effect* therefore, "are cancelled before they begin executing" > *does indeed*

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Jerry Krinock
On 2010 Mar 31, at 14:39, Mike Abdullah wrote: > [self cancelAllOperations]; > [self waitUntilAllOperationsAreFinished]; > > Cancelling the operations is asynchronous since an in-progress op may take a > little while to finish up. OK, but does -cancelAllOperations ultimately remove all operati

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Ken Thomases
On Mar 31, 2010, at 4:32 PM, Jerry Krinock wrote: >[self cancelAllOperations] ; > So you see in NSLog #1 there are 5 operations in the queue. This is > expected, because although the documentation for -cancelAllOperations is a > little vague, it does not say that it *removes* any operation

Re: -[NSOperationQueue cancelAllOperations] cleans queue, but not immediately?!

2010-03-31 Thread Mike Abdullah
[self cancelAllOperations]; [self waitUntilAllOperationsAreFinished]; Cancelling the operations is asynchronous since an in-progress op may take a little while to finish up. Mike. On 31 Mar 2010, at 22:32, Jerry Krinock wrote: > I execute the following code in a subclass of NSOperationQueue: >

Re: NSOperationQueue for NSXMLParser object

2009-11-05 Thread Marcel Weiher
Hi Chris, Let me start with what I'm trying to accomplish. I have an app that is constantly running an animation, which's attributes are determined after downloading and parsing some XML. How large are the XML files? Does each contain multiple animation steps or just one? The XML is

Re: NSOperationQueue for NSXMLParser object

2009-11-05 Thread Ken Thomases
On Nov 5, 2009, at 8:12 PM, Chris Purcell wrote: //Parse the XML - (void) parseXML:(NSTimer *)timer { XMLParser *parser = [[XMLParser alloc] initWithURL:@"Location of the XML" delegate:self]; [queue addOperation:parser]; [parser release]; //th

Re: NSOperationQueue emptying

2009-08-27 Thread Adam R. Maxwell
On Aug 27, 2009, at 8:18 AM, McLaughlin, Michael P. wrote: 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

Re: NSOperationQueue question

2009-08-10 Thread Tim Murison
> The first thing it should do in main() is invoke > objc_startCollectorThread() (from ) which will > ensure GC is happening asynchronously, rather than only when the > autorelease pool is drained. Thank you. I added the call to objc_startCollectorThread() and my simple sample no longer leaks memo

Re: NSOperationQueue question

2009-08-07 Thread Chris Hanson
Not only does the below code need to use -[NSAutoreleasePool drain] rather than -release, but it also doesn’t start the background collection thread. The first thing it should do in main() is invoke objc_startCollectorThread() (from ) which will ensure GC is happening asynchronously, rath

Re: NSOperationQueue question

2009-08-07 Thread Franck Zoccolo
Le 7 août 09 à 21:06, Tim Murison a écrit : The code is below and was compiled with objc-gc-only. Forget what I said... Maybe I should read carrefully before answering... Sorry for the noise. smime.p7s Description: S/MIME cryptographic signature ___

Re: NSOperationQueue question

2009-08-07 Thread Quincey Morris
On Aug 7, 2009, at 16:07, Tim Murison wrote: I enqueue operations until ~1000 have executed, then wait for the queue to be empty. Then sleep for 10 seconds and force a collection. Once the queue is empty there should be a maximum of 4 outstanding operations (the concurrency count). 10 second

Re: NSOperationQueue question

2009-08-07 Thread Tim Murison
On 07/08/09 5:30 PM, "Quincey Morris" wrote: > On Aug 7, 2009, at 14:06, Tim Murison wrote: > >> The improved code will execute about 1000 operations as quickly as >> possible, >> then it will sleep for 1 second. Before sleeping, it will print the >> operation queue length, proving that the q

Re: NSOperationQueue question

2009-08-07 Thread Greg Guerin
Tim Murison wrote: [pool release]; } } With GC, the memory use grows forever, without GC, it doesn't grow at all. With GC, [pool release] is a no-op. You should use [pool drain]. Quoted from NSAutoreleasePool Class Reference, under the description for -drain:

Re: NSOperationQueue question

2009-08-07 Thread Quincey Morris
On Aug 7, 2009, at 14:06, Tim Murison wrote: The improved code will execute about 1000 operations as quickly as possible, then it will sleep for 1 second. Before sleeping, it will print the operation queue length, proving that the queue doesn't grow for ever (it is always < 5000 on my machin

Re: NSOperationQueue question

2009-08-07 Thread Tim Murison
>> With GC, the memory use grows forever, without GC, it doesn't grow at all. >> Instruments tells me the garbage collector is responsible for allocating the >> leaking memory from within the collection routine, I think maybe instruments >> is confused, but it does confirm that the live object coun

Re: NSOperationQueue question

2009-08-07 Thread Sean McBride
On 8/7/09 5:06 PM, Tim Murison said: >With GC, the memory use grows forever, without GC, it doesn't grow at all. >Instruments tells me the garbage collector is responsible for allocating the >leaking memory from within the collection routine, I think maybe instruments >is confused, but it does con

Re: NSOperationQueue question

2009-08-07 Thread Tim Murison
On 07/08/09 4:33 PM, "Quincey Morris" wrote: > On Aug 7, 2009, at 13:05, Tim Murison wrote: > >> In my real application I have a memory leak that I can trace to >> operations >> not being release by the operation queue. This program is meant to >> show that >> in the simplest way possible. >

Re: NSOperationQueue question

2009-08-07 Thread Quincey Morris
On Aug 7, 2009, at 13:05, Tim Murison wrote: In my real application I have a memory leak that I can trace to operations not being release by the operation queue. This program is meant to show that in the simplest way possible. I really don't think it shows that at all. If your analysis is

Re: NSOperationQueue question

2009-08-07 Thread Tim Murison
> 'setMaxConcurrentOperationCount' specifies the number of concurrently > executing threads. I don't see anything in the documentation that > guarantees it will control the number of concurrently existing > threads. Threads may exist waiting to execute, and threads will exist > for some period of t

Re: NSOperationQueue question

2009-08-07 Thread Quincey Morris
On Aug 7, 2009, at 12:06, Tim Murison wrote: The code is below and was compiled with objc-gc-only. If I run the program, despite the setMaxConcurrentOperationCount:4, it will use 65 threads. Also it will leak memory at ~1Mb/sec. #import #include volatile int64_t globalCounter; @interfac

Re: NSOperationQueue question

2009-08-07 Thread Tim Murison
> Convenience constructors should autorelease objects they allocate. > But I'm using GC, so that can't be my problem right? *** This e-mail and its attachments are confidential, legally privileged, may be subject to copyrig

Re: NSOperationQueue bug with leopard 10.5.6?

2009-02-02 Thread Michael Ash
On Mon, Feb 2, 2009 at 1:59 PM, Barry Wark wrote: > First of all, thank you for shedding light on this bug; we're all > benefiting from your investigations. Thank you very much for saying so, it's much appreciated. > Is this still the case if all operations are added on the main thread > (i.e. e

Re: NSOperationQueue bug with leopard 10.5.6?

2009-02-02 Thread Barry Wark
On Fri, Jan 30, 2009 at 9:27 PM, Michael Ash wrote: > On Fri, Jan 30, 2009 at 11:25 PM, Nick Zitzmann wrote: >> >> On Jan 30, 2009, at 6:32 PM, jurin...@eecs.utk.edu wrote: >> >>> I attempted to use NSOperationQueue with NSInvocationOperations and after >>> several frustrating days found multiple

Re: NSOperationQueue bug with leopard 10.5.6?

2009-01-30 Thread Michael Ash
On Fri, Jan 30, 2009 at 11:25 PM, Nick Zitzmann wrote: > > On Jan 30, 2009, at 6:32 PM, jurin...@eecs.utk.edu wrote: > >> I attempted to use NSOperationQueue with NSInvocationOperations and after >> several frustrating days found multiple websights saying NSOperationQueue >> has a bug with Leopard

Re: NSOperationQueue bug with leopard 10.5.6?

2009-01-30 Thread Nick Zitzmann
On Jan 30, 2009, at 6:32 PM, jurin...@eecs.utk.edu wrote: I attempted to use NSOperationQueue with NSInvocationOperations and after several frustrating days found multiple websights saying NSOperationQueue has a bug with Leopard 10.5, that will be fixed with 10.6. Q1: does anyone know when

Re: NSOperationQueue broken?

2008-11-25 Thread Peter N Lewis
[Reposted by request on this thread for the archives] At 13:40 -0400 30/10/08, Michael Ash wrote: I hate to blame an OS bug but I see no other explanation, so here we go. I have a program which uses NSOperationQueue heavily. It uses lots of different queues each of which has a max concurrent op

Re: NSOperationQueue broken?

2008-10-31 Thread Michael Ash
On Thu, Oct 30, 2008 at 10:16 PM, Colin Barrett <[EMAIL PROTECTED]> wrote: > On Thu, Oct 30, 2008 at 5:30 PM, Michael Ash <[EMAIL PROTECTED]> wrote: >> Based on the state of the program when it crashes, it appears that the >> problem is caused by a race condition which occasionally causes two of >>

Re: NSOperationQueue broken?

2008-10-30 Thread Jamie Johnson
By overriding -start of NSInvocationOperation and wrapping the call to super in an try/catch block: [Switching to process 8541 local thread 0x2d03] Running… 2008-10-30 16:13:08.446 NSOp-Test[8541:1703] NSInvalidArgumentException - *** -[MyOp start]: receiver has already started or fini

Re: NSOperationQueue broken?

2008-10-30 Thread Colin Barrett
On Thu, Oct 30, 2008 at 5:30 PM, Michael Ash <[EMAIL PROTECTED]> wrote: > Based on the state of the program when it crashes, it appears that the > problem is caused by a race condition which occasionally causes two of > the worker threads that NSOperationQueue spawns to dequeue and execute > the sa

Re: NSOperationQueue broken?

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 6:04 PM, Jamie Johnson <[EMAIL PROTECTED]> wrote: > > Looks like you're hosing memory because the subsequent invocation operations > are being released prior to their completion as seen in this call stack: > > #0 0x1a0c in -[MyOp dealloc] at NSOp-Test.m:27 > #1

Re: NSOperationQueue broken?

2008-10-30 Thread Jamie Johnson
Looks like you're hosing memory because the subsequent invocation operations are being released prior to their completion as seen in this call stack: #0 0x1a0c in -[MyOp dealloc] at NSOp-Test.m:27 #1 0x94fba20f in NSPopAutoreleasePool #2 0x9504f3a8 in -[NSOperation start]

Re: NSOperationQueue broken?

2008-10-30 Thread Michael Ash
On Thu, Oct 30, 2008 at 2:45 PM, Quincey Morris <[EMAIL PROTECTED]> wrote: > On Oct 30, 2008, at 10:40, Michael Ash wrote: > >> [_queue addOperation:op]; > > Have you tried using performSelectorOnMainThread: to force serializing of > the queuing? It might be an acceptable workaround, if it works.

Re: NSOperationQueue broken?

2008-10-30 Thread Quincey Morris
On Oct 30, 2008, at 10:40, Michael Ash wrote: [_queue addOperation:op]; Have you tried using performSelectorOnMainThread: to force serializing of the queuing? It might be an acceptable workaround, if it works. ___ Cocoa-dev mailing list (Coco

Re: NSOperationQueue

2008-09-21 Thread Mike Fischer
Am 21.09.2008 um 22:46 schrieb John Love: has wrote: Getting back to the main discussion of the OP's threading/ NSOperationQueue problems, perhaps it would help if he backs up a bit and explains in general terms what he's trying to achieve, rather than focus on individual details of how he

Re: NSOperationQueue

2008-09-21 Thread John Love
has wrote: Getting back to the main discussion of the OP's threading/ NSOperationQueue problems, perhaps it would help if he backs up a bit and explains in general terms what he's trying to achieve, rather than focus on individual details of how he's currently trying to do it? That way, fo

Re: NSOperationQueue

2008-09-20 Thread has
Mike Fischer wrote: 12) Finally, my -calculateWorksheetRow looks like: - (void) calculateWorksheetRow { // column after column after column ... I didn't follow this complete discussion thread but I kind of read between the lines that your operation is actually calling a different proce

Re: NSOperationQueue

2008-09-19 Thread Mike Fischer
Am 20.09.2008 um 00:51 schrieb John Love <[EMAIL PROTECTED]>: No sooner do I say "Solved" that I determine "Not Solved". I am no longer crashing in part due to the fact that I've removed NSApplescript from the thread; however, the evidence is still insurmountable that the calculation is not run

Re: NSOperationQueue

2008-09-19 Thread Quincey Morris
On Sep 19, 2008, at 08:15, John Love wrote: 9) Its -startCalculation looks like: - (void) startCalculation { int row; // itsCalcStatus = kNoError; // set by -init for (row=1; row < 1; row++) { if (itsCalcStatus == kSpreadsh

Re: NSOperationQueue

2008-09-19 Thread John Love
No sooner do I say "Solved" that I determine "Not Solved". I am no longer crashing in part due to the fact that I've removed NSApplescript from the thread; however, the evidence is still insurmountable that the calculation is not running in a background Thread, but in the main thread. Beca

Re: NSOperationQueue

2008-09-13 Thread John Love
> FROM : Quincey Morris Your code is crashing because you're doing it wrong: On Sep 13, 2008, at 05:05, John Love wrote: > - (void) calculateWorksheet:(id)data { >int row; >for (row=1; row < 500; row++) { >// long calculation here >} > } > > - (void) startQueue { >NS

Re: NSOperationQueue

2008-09-13 Thread Quincey Morris
Your code is crashing because you're doing it wrong: On Sep 13, 2008, at 05:05, John Love wrote: - (void) calculateWorksheet:(id)data { int row; for (row=1; row < 500; row++) { // long calculation here } } - (void) startQueue { NSLog(@"start queue"); // I see this in the d

Re: NSOperationQueue

2008-09-13 Thread John Love
I found the source of my mess .. should have just passed nil to my selector = calculateWorksheet: John Love = On Sep 13, 08, at 11:46 AM, Shawn Erickson wrote: On Sep 13, 2008, at 8:34 AM, John Love wrote: > For clarification: It crashes after you call stopCalculation? Does it > cr

Re: NSOperationQueue

2008-09-13 Thread Shawn Erickson
On Sep 13, 2008, at 8:34 AM, John Love wrote: > For clarification: It crashes after you call stopCalculation? Does it > crash if you let the entire calculation complete? It crashes in the process of letting the entire calculation complete. Sounds like something is wrong in your calculation

Re: NSOperationQueue

2008-09-13 Thread John Love
> For clarification: It crashes after you call stopCalculation? Does it > crash if you let the entire calculation complete? It crashes in the process of letting the entire calculation complete. If I place NSLog(@"start queue") at the beginning of -startQueue, the Debugger shows "start queue".

Re: NSOperationQueue

2008-09-13 Thread Jaime Magiera
On Sep 13, 2008, at 8:07 AM, John Love wrote: // I also call this method from another Controller - (void) stopCalculation { [self stopQueue]; } For clarification: It crashes after you call stopCalculation? Does it crash if you let the entire calculation complete? Jaime Magiera Se

Re: NSOperationQueue Memory Leak

2008-08-07 Thread Brock Batsell
Inside your for loop you are allocating 10,000 NSInvocationOperation objects without adding them to your autorelease pool. Adding [processor autorelease]; as the last line of the for loop killed memory leakage for me. Without it my real memory would jump 10 MB each time queueOperations: ran, with

Re: NSOperationQueue Memory Leak

2008-08-07 Thread Michael Ash
On Wed, Aug 6, 2008 at 9:38 AM, Mike Simmons <[EMAIL PROTECTED]> wrote: > I have an audio application that processes numerous audio streams into > ten-second clips, compresses the clips, and saves them to disk. Naturally, I > wanted to move from single-threaded processing to multithreaded processin

Re: NSOperationQueue Memory Leak

2008-08-06 Thread Shripada Hebbar
Hi Mike processor = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(sayHi:) object:nil]; You are not releasing the operation objects you create!. You should have released them soon after they were added to the queue. -- [operationQueue addOperation:proce

Re: NSOperationQueue Memory Leak

2008-08-06 Thread Nick Zitzmann
On Aug 6, 2008, at 7:38 AM, Mike Simmons wrote: processor = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(sayHi:) object:nil]; Why aren't you releasing this object? Nick Zitzmann ___ Cocoa-de