[Top][All Lists]

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

Re: GNUstep-gui make problems (linking pthreads)

From: Richard Frith-Macdonald
Subject: Re: GNUstep-gui make problems (linking pthreads)
Date: Tue, 1 Apr 2003 10:29:56 +0100

On Tuesday, April 1, 2003, at 09:58  am, David Ayers wrote:


Banlu Kemiyatorn wrote:

hello, I have a question.
how can I stop sorting an array while it is being sorted?
I want to sort a big array in a seperated thread but sometimes
the data that being sorted is obsolete and I don't want to
waste cpu time with that thread anymore. is it a safe way to
release the array and exit thread within the compare method?

No it wouldn't be as the code doing the sorting has no way of knowing that 'self' (a variable) has become obsolete. I think you will probably need a custom subclass of NSArray which implements an invalidatin mechanism a sorting routine which uses it.

Perhaps you could sort using a function rather than the selector, and provide a mechanism for that function to tell that sorting should be aborted (upon which it could cause the thread to exit).

reply via email to

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