Re: Exact semantics of NSThread executation states?

2016-07-12 Thread Glenn L. Austin
> On Jul 12, 2016, at 2:52 PM, Sean McBride wrote: > > Hi all, > > NSThread has at least 3 execution state properties: executing, finished, > cancelled. Alas, the docs don't say much about what they mean beyond > circular definitions like "A Boolean v

Exact semantics of NSThread executation states?

2016-07-12 Thread Sean McBride
Hi all, NSThread has at least 3 execution state properties: executing, finished, cancelled. Alas, the docs don't say much about what they mean beyond circular definitions like "A Boolean value that indicates whether the receiver is executing". I have code where I create an

Re: NSThread to NSOperation and blockUntil

2016-03-22 Thread Graham Cox
> On 22 Mar 2016, at 5:33 PM, Trygve Inda wrote: > > So I need to be able to have a process done in 30 seconds for example At > full speed it could be done in 4 seconds but I'd like it done with as little > impact as possible. So just let it run as fast as possible. The whole point of thre

Re: NSThread to NSOperation and blockUntil

2016-03-22 Thread Jens Alfke
> On Mar 22, 2016, at 2:33 AM, Trygve Inda wrote: > > So I need to be able to have a process done in 30 seconds for example At > full speed it could be done in 4 seconds but I'd like it done with as little > impact as possible. I don’t think it makes much difference to other system threads

Re: NSThread to NSOperation and blockUntil

2016-03-21 Thread Trygve Inda
> On Mar 21, 2016, at 18:07 , Trygve Inda wrote: >> >> I would like to move this to NSOperation and NSOperationQueue but I see no >> way to replicate this behavior. > > I think the GCD/NSOperationQueue concept of “background” quality of service is > what you want here. That would let your re-fac

Re: NSThread to NSOperation and blockUntil

2016-03-21 Thread Quincey Morris
On Mar 21, 2016, at 18:07 , Trygve Inda wrote: > > I would like to move this to NSOperation and NSOperationQueue but I see no > way to replicate this behavior. I think the GCD/NSOperationQueue concept of “background” quality of service is what you want here. That would let your re-factored calc

NSThread to NSOperation and blockUntil

2016-03-21 Thread Trygve Inda
I have a thread that is invoked with: [NSThread detachNewThreadSelector:@selector(threadMethod:) toTarget:self withObject:self]; It uses NSConditionLock and works well. This thread performs a complex process but does it slowly so as to not use much processor time. I specify how long I want it

Re: [NSThread callStackSymbols] weirdness

2016-02-04 Thread Jens Alfke
> On Feb 3, 2016, at 11:28 PM, Trygve Inda wrote: > > why do I get to > see 3 method calls in my own app in the first example, but only the last call > in the second example? Tail-call optimization, probably. If the last thing a function does is call another function, the optimizer will chang

[NSThread callStackSymbols] weirdness

2016-02-03 Thread Trygve Inda
I am trying to track down a difficult bug on a customer's machine. I have inserted [NSThread callStackSymbols] at a critical place in the app where I want to see how it got there. When running a debug version, either in the debugger or not, I see: 2/3/16 10:53:51.070 PM MyApp Core[

Re: -[NSThread start] blocks ?!?

2015-10-17 Thread Jerry Krinock
> On 2015 Sep 28, at 13:10, Greg Parker wrote: > > The threads listed are all waiting for a spinlock used by the debugging > tools. (Specifically, it's the machinery that records stack traces of queue > operations.) > > If you see this again, please capture a spindump and file a bug report. >

Re: NSThread subclass get blocked on 'start' method call

2015-09-28 Thread Jens Alfke
Foundation`-[NSThread cancel] + 29 * frame #4: 0x00010164d83b ThreadFail`-[MyThread dealloc](self=0x7fdcb8d328b0, _cmd="dealloc") + 43 at MyThread.m:15 frame #5: 0x000101b62afe libobjc.A.dylib`objc_object::sidetable_release(bool) + 232 Calling [self cancel] inside an

Re: -[NSThread start] blocks ?!?

2015-09-28 Thread Greg Parker
> On Sep 26, 2015, at 3:33 PM, Jerry Krinock wrote: > > In a OS X app, predating Grand Central Dispatch, in the main thread, I create > and start a new thread > > NSThread* worker ; > worker = [[NSThread alloc] initWithTarget:instance >

Re: NSThread subclass get blocked on 'start' method call

2015-09-28 Thread Alexey Belkevich
On 28 сентября 2015 at 8:00:43 , Jens Alfke (j...@mooseyard.com) wrote: On Sep 28, 2015, at 9:29 AM, Alexey Belkevich wrote: Here is the source code of Example -  https://www.dropbox.com/s/r5k8o28pocu7afk/aptest.zip?dl=0 Can you isolate this down to something less complex? There’s a lot of sou

Re: NSThread subclass get blocked on 'start' method call

2015-09-28 Thread John Daniel
> On Sep 28, 2015, at 3:00 PM, cocoa-dev-requ...@lists.apple.com wrote: > > I have problem with NSThread subclass. It's very similar to this case - > http://prod.lists.apple.com/archives/cocoa-dev/2015/Sep/msg00454.html > <http://prod.lists.apple.com/archives/cocoa-dev

Re: NSThread subclass get blocked on 'start' method call

2015-09-28 Thread Jens Alfke
> On Sep 28, 2015, at 9:29 AM, Alexey Belkevich > wrote: > > Here is the source code of Example - > https://www.dropbox.com/s/r5k8o28pocu7afk/aptest.zip?dl=0 > Can you isolate this down to something less complex? There’s a lot of so

NSThread subclass get blocked on 'start' method call

2015-09-28 Thread Alexey Belkevich
I have problem with NSThread subclass. It's very similar to this case -  http://prod.lists.apple.com/archives/cocoa-dev/2015/Sep/msg00454.html. I have a library, that provide developer-friendly interface to AddressBook.framework. And I unable to use GCD for thread safety, becau

Re: -[NSThread start] blocks ?!?

2015-09-28 Thread John Daniel
> On Sep 28, 2015, at 12:13 AM, cocoa-dev-requ...@lists.apple.com > <mailto:cocoa-dev-requ...@lists.apple.com> wrote: > > Thank you, John. You are referring to what my secondary thread is doing. My > point is that if we can’t at least rely on -[NSThread start] re

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Ken Thomases
> On Sep 27, 2015, at 8:49 PM, Jerry Krinock wrote: > > My point is that if we can’t at least rely on -[NSThread start] returning > before the secondary starts, there is no way for a seconary thread to call > back to the main thread without possibility of deadlock. No, this i

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Charles Srstka
> On Sep 27, 2015, at 11:18 PM, Jens Alfke wrote: > >> On Sep 27, 2015, at 8:49 PM, Jerry Krinock > <mailto:je...@ieee.org>> wrote: >> >> My point is that if we can’t at least rely on -[NSThread start] returning >> before the secondary starts, the

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Jens Alfke
—Jens > On Sep 27, 2015, at 8:49 PM, Jerry Krinock wrote: > > My point is that if we can’t at least rely on -[NSThread start] returning > before the secondary starts, there is no way for a seconary thread to call > back to the main thread without possibility of deadlock

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Jerry Krinock
point is that if we can’t at least rely on -[NSThread start] returning before the secondary starts, there is no way for a seconary thread to call back to the main thread without possibility of deadlock. It’s a defect in NSThread. > Data sharing using serial queues is safer and more robust

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread John Daniel
> In a OS X app, predating Grand Central Dispatch, in the main thread, I create > and start a new thread > > NSThread* worker ; > worker = [[NSThread alloc] initWithTarget:instance > selector:@sele

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Jens Alfke
> On Sep 27, 2015, at 6:50 AM, Jerry Krinock wrote: > > I mean that if it is possible for -[NSThread start] to block indefinitely, it > is not a useable API. It’s not. The new thread will start when the kernel's scheduler gives it time. That’s technically indefinite,

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Jerry Krinock
> On 2015 Sep 26, at 18:03, Quincey Morris > wrote: > > I don’t understand what you’re asking. I mean that if it is possible for -[NSThread start] to block indefinitely, it is not a useable API. I clicked the “Pause” and “Continue” multiple times in Xcode, but each time, in the

Re: -[NSThread start] blocks ?!?

2015-09-27 Thread Ken Thomases
On Sep 26, 2015, at 5:33 PM, Jerry Krinock wrote: > In a OS X app, predating Grand Central Dispatch, in the main thread, I create > and start a new thread > > NSThread* worker ; > worker = [[NSThread alloc] initWithTarget:instance >

Re: -[NSThread start] blocks ?!?

2015-09-26 Thread Quincey Morris
On Sep 26, 2015, at 16:49 , Jerry Krinock wrote: > > By “starter thread”, I presume you mean the one which is invoking -[NSThread > start]. Yup. > If what you are saying is true, how could we ever execute > -performSelectorOnMainThread::: in a secondary thread without

Re: -[NSThread start] blocks ?!?

2015-09-26 Thread Jerry Krinock
> On 2015 Sep 26, at 15:53, Quincey Morris > wrote: > > On Sep 26, 2015, at 15:33 , Jerry Krinock wrote: >> >> Should not -[NSThread start] always return before running any of my code in >> the new thread? > > You have absolutely no control ov

Re: -[NSThread start] blocks ?!?

2015-09-26 Thread Quincey Morris
On Sep 26, 2015, at 15:33 , Jerry Krinock wrote: > > Should not -[NSThread start] always return before running any of my code in > the new thread? You have absolutely no control over it, unless you introduce your own synchronization mechanisms. The *earliest* it can return is befor

-[NSThread start] blocks ?!?

2015-09-26 Thread Jerry Krinock
In a OS X app, predating Grand Central Dispatch, in the main thread, I create and start a new thread NSThread* worker ; worker = [[NSThread alloc] initWithTarget:instance selector:@selector(beginWithInfo:) object:info] ; [worker

Re: NSThread

2015-01-13 Thread Raglan T. Tiger
dullah wrote: >>> >>> >>>> On 13 Jan 2015, at 16:07, Raglan T. Tiger wrote: >>>> >>>> I allocate and init an NSThread as follows: >>>> >>>> if ( m_mythread ) [m_mythread cancel]; >>>> m_myth

Re: NSThread

2015-01-13 Thread Corbin Dunn
> On Jan 13, 2015, at 9:57 AM, Mike Abdullah wrote: > > >> On 13 Jan 2015, at 16:18, Mike Abdullah wrote: >> >> >>> On 13 Jan 2015, at 16:07, Raglan T. Tiger wrote: >>> >>> I allocate and init an NSThread as follows: >>> >

Re: NSThread

2015-01-13 Thread Mike Abdullah
> On 13 Jan 2015, at 16:18, Mike Abdullah wrote: > > >> On 13 Jan 2015, at 16:07, Raglan T. Tiger wrote: >> >> I allocate and init an NSThread as follows: >> >> if ( m_mythread ) [m_mythread cancel]; >> m_mythread = [[MYThread

Re: NSThread

2015-01-13 Thread Mike Abdullah
> On 13 Jan 2015, at 17:50, Raglan T. Tiger wrote: > >> On Jan 13, 2015, at 9:18 AM, Mike Abdullah > > wrote: >> >> Step 1 of diagnosis: take a sample. > > How would that be accomplished ? A simple user-facing way is to fire up Activity Monitor, select your app,

Re: NSThread

2015-01-13 Thread Raglan T. Tiger
> On Jan 13, 2015, at 9:18 AM, Mike Abdullah wrote: > > Step 1 of diagnosis: take a sample. How would that be accomplished ? -rags ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to

Re: NSThread

2015-01-13 Thread Mike Abdullah
> On 13 Jan 2015, at 16:07, Raglan T. Tiger wrote: > > I allocate and init an NSThread as follows: > >if ( m_mythread ) [m_mythread cancel]; >m_mythread = [[MYThread alloc] initWithTarget:m_mythread > selector:@selector(start) object:m_anobject]; >

NSThread

2015-01-13 Thread Raglan T. Tiger
I allocate and init an NSThread as follows: if ( m_mythread ) [m_mythread cancel]; m_mythread = [[MYThread alloc] initWithTarget:m_mythread selector:@selector(start) object:m_anobject]; [m_mythread start]; I set a break in -start and see that this is a separate thread

Re: [GM-help] [Q] calling OpenMP functions in a thread function for NSThread?

2011-07-29 Thread JongAm Park
On Jul 29, 2011, at 2:03 PM, Bob Friesenhahn wrote: > On Fri, 29 Jul 2011, JongAm Park wrote: >> >> is there a problem in calling OpenMP functions in a thread function? > > Possibly there is, however, I recall that your main program uses Objective C. > Perhaps the Objective C runtime does not

[Q] calling OpenMP functions in a thread function for NSThread?

2011-07-29 Thread JongAm Park
Hello, I'm using a GraphicsMagick library in my project. However, there I found a very interesting behavior. If I create an instance of Magick::Image in a normal method, it works OK. However, if it is implemented in a thread function, it crashes when it calls omp_get_max_threads(). I tried t

Re: Question about NSThread

2011-07-14 Thread Ken Thomases
On Jul 14, 2011, at 9:08 AM, Eric E. Dolecki wrote: > I haven't done much research, but if I have a method that does a lot of > looping, can I just safely bust this off (fire and forget)? > > [NSThread detachNewThreadSelector:@selector(generateBigData) toTarget:self > withO

Re: Question about NSThread

2011-07-14 Thread Eric E. Dolecki
if I have a method that does a lot of > > looping, can I just safely bust this off (fire and forget)? > > > > [NSThread detachNewThreadSelector:@selector(generateBigData) > toTarget:self > > withObject:nil]; > > > _

Re: Question about NSThread

2011-07-14 Thread Jeff Kelley
queue). Jeff Kelley On Thu, Jul 14, 2011 at 10:08 AM, Eric E. Dolecki wrote: > I haven't done much research, but if I have a method that does a lot of > looping, can I just safely bust this off (fire and forget)? > > [NSThread detachNewThreadSelector:@selector(generateBigDa

Question about NSThread

2011-07-14 Thread Eric E. Dolecki
I haven't done much research, but if I have a method that does a lot of looping, can I just safely bust this off (fire and forget)? [NSThread detachNewThreadSelector:@selector(generateBigData) toTarget:self withObject:nil]; ___ Cocoa-dev mailing

Re: Synthesize getter in a NSThread

2011-05-21 Thread Tony Romano
Yes, allocating the pool in the loop in conjunction with the drain did the trick. It wont be too bad in the actual code because my thread is not free running with a while(1), I use a condition lock. Thanks for the help guys. Tony Romano On 5/21/11 8:31 PM, "Roland King" wrote: >both allocate

Re: Synthesize getter in a NSThread

2011-05-21 Thread Roland King
both allocate a new pool AND drain it each iteration of the loop while( 1 ) { pool = [ [ NSAutoReleasePool alloc ] init ]; // do stuff [ pool drain ]; } On 22-May-2011, at 11:28 AM, Tony Romano wrote: > Unless I misread the documentation on drain, adding a [pool

Re: Synthesize getter in a NSThread

2011-05-21 Thread Tony Romano
Unless I misread the documentation on drain, adding a [pool drain]will cause the pool to be deallocated. I tried it anyways, and I get a couple of emits in the console. // This message emits when a call to the getter is made 2011-05-21 20:23:39.515 LeakyThread[5947:5707] *** __NSAutoreleaseNoPool

Re: Synthesize getter in a NSThread

2011-05-21 Thread Ken Thomases
On May 21, 2011, at 3:27 PM, Tony Romano wrote: > I am running into an issue using a synthesized getter in a thread. > Observing memory consumed by the application in Activity Monitor, memory > continues to grow ~200k per sample until the OS gives an Out Of Memory > warning. If I code my own gett

Synthesize getter in a NSThread

2011-05-21 Thread Tony Romano
I am running into an issue using a synthesized getter in a thread. Observing memory consumed by the application in Activity Monitor, memory continues to grow ~200k per sample until the OS gives an Out Of Memory warning. If I code my own getter, the app behaves as expected. I have striped it down

Re: NSThread

2011-03-08 Thread Bill Bumgarner
On Mar 8, 2011, at 12:33 AM, Bruno Causse wrote: > the performance is not a problem, all my threads are waiting for a answer to > a request. That is potentially still a big problem as every thread uses kernel resources, reserves memory for a stack, and otherwise pollutes the kernel's schedulin

Re: NSThread

2011-03-08 Thread Bruno Causse
the performance is not a problem, all my threads are waiting for a answer to a request. my program is a kind of working's Distributor. Le 8 mars 11 à 08:20, Bill Bumgarner a écrit : On Mar 7, 2011, at 12:27 PM, Bruno Causse wrote: hi all, how many NSThread i can create? Quite

Re: NSThread

2011-03-07 Thread Bill Bumgarner
On Mar 7, 2011, at 12:27 PM, Bruno Causse wrote: > hi all, > > how many NSThread i can create? Quite a few more than are useful, performant, or optimal... b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not p

NSThread

2011-03-07 Thread Bruno Causse
hi all, how many NSThread i can create? what happens when the limit is exceeded? seems [[NSThread alloc] initWithTarget] never returns nil :( thx a lot -- Bruno Causse BEGIN:VCARD VERSION:3.0 N:Causse;Bruno;;; FN:Bruno Causse EMAIL;type=INTERNET;type=HOME;type=pref:bruno.cau...@free.fr

Issue with NSthread

2011-03-02 Thread Aman (neshu) Agarwal
Hello, I am new with COCOA API, I am trying to call function from other class via object but it's not call it delegate after completion of the procedure while when I call it on main thread delegate will execute but I am not able to catch up the data :'( [NSThread detachNewThre

Re: Difference between NSOperationQueue and NSThread in iOS4?

2010-08-25 Thread David Duncan
On Aug 25, 2010, at 9:50 AM, Dave Carrigan wrote: > I would bet that NSOperation on iOS4 is using grand central dispatch, whereas > NSOperation on iOS3 probably used NSThreads. In any case, as the other > commenter said, doing UI operations on any thread other than the main one is > going to ca

Re: Difference between NSOperationQueue and NSThread in iOS4?

2010-08-25 Thread Dave Carrigan
On Aug 25, 2010, at 9:41 AM, Scott Andrew wrote: > I'll need to refigure this out becuase we are trying to load/draw a fairly > complex page where the scrollview is transparent and there are several > composited buttons on a an almost full screen view. I am still curious why > this would work

Re: Difference between NSOperationQueue and NSThread in iOS4?

2010-08-25 Thread Scott Andrew
t On Aug 25, 2010, at 7:22 AM, Michael Ash wrote: > On Tue, Aug 24, 2010 at 2:42 PM, Scott Andrew > wrote: >> I have a question that I have been researching but can't find an answer for. >> >> I have some iOS 3.2 code using NSOperation this doesn't work using

Re: Difference between NSOperationQueue and NSThread in iOS4?

2010-08-25 Thread Michael Ash
On Tue, Aug 24, 2010 at 2:42 PM, Scott Andrew wrote: > I have a question that I have been researching but can't find an answer for. > > I have some iOS 3.2 code using NSOperation this doesn't work using > NSOperation but works using NSThread withe detatch thread in iO

Difference between NSOperationQueue and NSThread in iOS4?

2010-08-24 Thread Scott Andrew
I have a question that I have been researching but can't find an answer for. I have some iOS 3.2 code using NSOperation this doesn't work using NSOperation but works using NSThread withe detatch thread in iOS4 with the desired effect. My code is basically to create and generate pa

Re: NSThread Subclassing problem for Singleton instance

2010-07-12 Thread Kyle Sluder
On Mon, Jul 12, 2010 at 12:33 PM, Abhinav Tyagi wrote: > Thanks for giving your valuable time to this post. > I have been working on Mac platform since last 5 months prior to which I have > worked on Windows platform. > I have used threads using  NSThread's > detachNewThreadSelector:@selector() ea

NSThread Subclassing problem for Singleton instance

2010-07-12 Thread Abhinav Tyagi
scode the incoming data to WAVE. As I am working on OSX 10.5 and 10.6, I have derived an interface Internetradio from NSThread class. To avoid interference with main thread, I have derieved a class from NSthread so that whole Internetradio functionality work in separate thread and doesnt interfere

Re: Pausing an NSThread

2009-11-09 Thread Jens Alfke
o and send it off and some thread somewhere will do it for you. For the record: +1 to this. Let NSOperationQueue manage concurrency for you instead of using NSThread, unless you really know what you're doing with multithreading. It's much e

Re: Pausing an NSThread

2009-11-08 Thread Ron Fleckner
Many thanks to all who helped with this. I've had some very useful discussion off-list with Roland King and I'm on my way to threading nirvana. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or modera

Re: NSTextView won't update via NSThread

2009-11-08 Thread Dalton Hamilton
solve the problem really. 2. The second problem is the application hangs using this method. If I don't use the readInBackgroundAndNotify and simply use NSThread and performSelectorOnMainThread it never hangs and I get full text output. Here is small piece of my code: http://web.me.co

Re: Pausing an NSThread

2009-11-08 Thread Roland King
On 08-Nov-2009, at 5:37 PM, Ron Fleckner wrote: Hi Greg, thanks for the link. I think I've learned that the effect of pausing a thread can be just as easily and more safely achieved by simply stopping it depending on a BOOL on the main thread. Yes? So, in my situation, I would send

Re: Pausing an NSThread

2009-11-08 Thread Ron Fleckner
On 08/11/2009, at 4:34 PM, Greg Guerin wrote: Ron Fleckner wrote: I've finally worked out a way to pause a thread and would like to know if what I'm doing is dangerous or bad or...? Exactly what problem are you trying to solve? Pausing a thread is always potentially dangerous. Any locks

Re: Pausing an NSThread

2009-11-07 Thread Greg Guerin
Ron Fleckner wrote: I've finally worked out a way to pause a thread and would like to know if what I'm doing is dangerous or bad or...? Exactly what problem are you trying to solve? Pausing a thread is always potentially dangerous. Any locks or @synchronized blocks acquired before reachin

Re: Pausing an NSThread

2009-11-07 Thread Ron Fleckner
On 08/11/2009, at 2:36 PM, Dave DeLong wrote: Instead of a BOOL on the main thread, what about an NSLock? Start off by locking it on the main thread, and then the secondary thread can try to lock it, block (because it can't acquire the lock since the main thread has it), and not resume un

Re: Pausing an NSThread

2009-11-07 Thread Kyle Sluder
On Sat, Nov 7, 2009 at 7:28 PM, Ron Fleckner wrote: > This is a small proof-of-concept/test kind of project. I've had a look at > NSConditionLock, but I don't get the concepts.  So I've got this naïve > solution, which is a kind of polling, I know, but it _seems_ to work quite > well.  The CPU usa

Re: Pausing an NSThread

2009-11-07 Thread Dave DeLong
well. The CPU usage goes down to zero according to Activity Monitor while the thread is 'paused'. That's gotta be a good sign. After detaching a new thread with [NSThread detachNewThreadSelector:@selector(mySelector:) toTarget:self withObject:[self arrayOfObjects]]; //

Pausing an NSThread

2009-11-07 Thread Ron Fleckner
naïve solution, which is a kind of polling, I know, but it _seems_ to work quite well. The CPU usage goes down to zero according to Activity Monitor while the thread is 'paused'. That's gotta be a good sign. After detaching a new thread with [NSThread detachNewThreadSelec

Re: NSTextView won't update via NSThread

2009-11-06 Thread Stephen J. Butler
On Thu, Nov 5, 2009 at 6:20 AM, Dalton Hamilton wrote: > Does anyone have any idea why NSTextView won't update when the code is a > thread? Because everything in AppKit is thread-unsafe, unless specifically marked safe. ___ Cocoa-dev mailing list (Coco

Re: NSTextView won't update via NSThread

2009-11-06 Thread Ken Thomases
On Nov 5, 2009, at 6:20 AM, Dalton Hamilton wrote: Does anyone have any idea why NSTextView won't update when the code is a thread? Yes, because Cocoa generally doesn't support manipulating the GUI from any thread other than the main thread. Read through this: http://developer.apple.com/m

NSTextView won't update via NSThread

2009-11-06 Thread Dalton Hamilton
Hello, I'm doing the below and when I call the -runTask: method is called from the main run loop (no threading) with [self runTask:self]; the NSTextView updates great; however, when I call -runTask via [NSThread detachNewThreadSelector:@selector(runTask:) toTarget

Re: about NSThread crash

2009-06-24 Thread Ken Thomases
On Jun 24, 2009, at 1:49 AM, Chris(吴潮江) wrote: On Jun 24, 2009, at 2:28 AM, Ken Thomases wrote: You probably don't need to use a background thread to do FTP. You can do it using asynchronous methods on the main thread. Since you can, you probably should. It's almost always less error

Re: about NSThread crash

2009-06-23 Thread Chris(吴潮江)
On Jun 24, 2009, at 2:28 AM, Ken Thomases wrote: You probably don't need to use a background thread to do FTP. You can do it using asynchronous methods on the main thread. Since you can, you probably should. It's almost always less error prone and even more efficient. Considering t

Re: about NSThread crash

2009-06-23 Thread Ken Thomases
{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // Here I implement FTP functions. e.g. download/ pause download/ resume download file. [pool release]; [NSThread exit]; } You probably don't need to use a background thread to do FTP. You can do it using asynchronous methods o

about NSThread crash

2009-06-23 Thread Chris(吴潮江)
]; // Here I implement FTP functions. e.g. download/ pause download/ resume download file. [pool release]; [NSThread exit]; } To my surprise, when downloading a file, I pause download and no error display. Then I resume to download file, it's ok. However, at this time I pause dow

Re: NSURLConnection vs. NSThread

2009-05-15 Thread Michael Ash
some programmers might find using NSThread fits their way > of thinking best. Others might find NSURLConnection fits best. I encourage > the individual programmer here to go with his or her gut. Going with your gut is usually a bad idea in any case, but it's especially bad when you hav

Re: NSURLConnection vs. NSThread

2009-05-15 Thread Luke the Hiesterman
On May 14, 2009, at 5:35 PM, Michael Ash wrote: I agree completely that the simplest code should win, but I also think that the thread adds complexity, not just overhead. My point is that some programmers might find using NSThread fits their way of thinking best. Others might find

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Eric E. Dolecki
, George Warner wrote: > On Thu, 14 May 2009 16:52:48 -0400, Eric E. Dolecki" > wrote: > > Just curious, but if I am loading images into a UIImageView in table cells > from online URLs, is it better to use NSThread or use async NSURLConnection > to ensure that the scrollin

Re: NSURLConnection vs. NSThread

2009-05-14 Thread George Warner
On Thu, 14 May 2009 16:52:48 -0400, Eric E. Dolecki" wrote: Just curious, but if I am loading images into a UIImageView in table cells from online URLs, is it better to use NSThread or use async NSURLConnection to ensure that the scrolling is smooth while images are loaded in?

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Michael Ash
On Thu, May 14, 2009 at 6:42 PM, Luke the Hiesterman wrote: > To add to that thought, I should add that even if there is a performance > difference, I'd be surprised if it's anything that anyone would notice. It's > generally a mistake to assume there's a performance problem with a certain > appro

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Mike Abdullah
3:39 PM, Luke the Hiesterman wrote: Why is it assumed that threads created by NSURLConnection are faster than threads created manually with NSThread? Luke On May 14, 2009, at 3:36 PM, Mike Abdullah wrote: Threads would be unnecessary hassle and probably slower performing. NSURLConnect

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Alastair Houghton
On 14 May 2009, at 23:39, Luke the Hiesterman wrote: Why is it assumed that threads created by NSURLConnection are faster than threads created manually with NSThread? It isn't. Mike's point is that the chances of someone who is asking whether or not to use NSThread on a develop

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
wrote: Why is it assumed that threads created by NSURLConnection are faster than threads created manually with NSThread? Luke On May 14, 2009, at 3:36 PM, Mike Abdullah wrote: Threads would be unnecessary hassle and probably slower performing. NSURLConnection maintains its own private thread fo

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
Why is it assumed that threads created by NSURLConnection are faster than threads created manually with NSThread? Luke On May 14, 2009, at 3:36 PM, Mike Abdullah wrote: Threads would be unnecessary hassle and probably slower performing. NSURLConnection maintains its own private thread for

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Mike Abdullah
Threads would be unnecessary hassle and probably slower performing. NSURLConnection maintains its own private thread for performing the work of all open URL connections, even if you are using the synchronous API. By using NSThread, you are just bringing an extra unnecessary thread into the

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Luke the Hiesterman
I actually think for a simple case like this one, the NSThread approach will have simpler, more straightforward code. I say go with whichever way makes more sense for your style of coding. Luke On May 14, 2009, at 2:56 PM, Michael Ash wrote: On Thu, May 14, 2009 at 4:52 PM, Eric E. Dolecki

Re: NSURLConnection vs. NSThread

2009-05-14 Thread Michael Ash
On Thu, May 14, 2009 at 4:52 PM, Eric E. Dolecki wrote: > Just curious, but if I am loading images into a UIImageView in table cells > from online URLs, is it better to use NSThread or use async NSURLConnection > to ensure that the scrolling is smooth while images are loaded in? I&#x

NSURLConnection vs. NSThread

2009-05-14 Thread Eric E. Dolecki
Just curious, but if I am loading images into a UIImageView in table cells from online URLs, is it better to use NSThread or use async NSURLConnection to ensure that the scrolling is smooth while images are loaded in? Eric ___ Cocoa-dev mailing list

Re: Cancel NSThread - cocoa/mysql database search...

2009-05-08 Thread Andrew Farmer
On 08 May 09, at 07:08, spartan g wrote: But the problem I am facing now is, once i sent the query to MySQL through SMySQL framework, I am unable to cancel it. This query takes so much time to return the results and cannot be canceled as far as I understand. Is there any way to cancel this qu

Re: Cancel NSThread - cocoa/mysql database search...

2009-05-08 Thread spartan g
ote: > >> I am working on cocoa – MySQL application that connects to the MySQL >> database and retrieves the records. >> I run the search in a NSThread. I wish to cancel the search if needed, as >> the searching of the desired data takes 15-20 minutes due to the bigger >&g

Re: Cancel NSThread - cocoa/mysql database search...

2009-05-06 Thread Bill Bumgarner
On May 6, 2009, at 8:22 AM, Sparta wrote: I am working on cocoa – MySQL application that connects to the MySQL database and retrieves the records. I run the search in a NSThread. I wish to cancel the search if needed, as the searching of the desired data takes 15-20 minutes due to the bigger

Re: Cancel NSThread - cocoa/mysql database search...

2009-05-06 Thread Michael Ash
On Wed, May 6, 2009 at 11:22 AM, Sparta wrote: > Hi Friends, > > I am working on cocoa ­ MySQL application that connects to the MySQL > database and retrieves the records. > I run the search in a NSThread. I wish to cancel the search if needed, as > the searching of the desire

Cancel NSThread - cocoa/mysql database search...

2009-05-06 Thread Sparta
Hi Friends, I am working on cocoa ­ MySQL application that connects to the MySQL database and retrieves the records. I run the search in a NSThread. I wish to cancel the search if needed, as the searching of the desired data takes 15-20 minutes due to the bigger size of database. Please suggest

Re: NSRunLoop vs. NSThread sleep

2009-04-29 Thread Michael Ash
On Wed, Apr 29, 2009 at 6:53 AM, Alastair Houghton wrote: > On 29 Apr 2009, at 11:44, Kyle Sluder wrote: > >> On Wed, Apr 29, 2009 at 6:00 AM, Alastair Houghton >> wrote: >>> >>> But all of this is somewhat academic in a way, because Apple has handily >>> provided NSOperationQueue for you which i

Re: NSRunLoop vs. NSThread sleep

2009-04-29 Thread Alastair Houghton
On 29 Apr 2009, at 11:44, Kyle Sluder wrote: On Wed, Apr 29, 2009 at 6:00 AM, Alastair Houghton wrote: But all of this is somewhat academic in a way, because Apple has handily provided NSOperationQueue for you which is probably what you should be using unless you have some backwards compati

Re: NSRunLoop vs. NSThread sleep

2009-04-29 Thread Kyle Sluder
On Wed, Apr 29, 2009 at 6:00 AM, Alastair Houghton wrote: > But all of this is somewhat academic in a way, because Apple has handily > provided NSOperationQueue for you which is probably what you should be using > unless you have some backwards compatibility requirement or some other > requirement

Re: NSRunLoop vs. NSThread sleep

2009-04-29 Thread Alastair Houghton
On 29 Apr 2009, at 00:57, Eric Hermanson wrote: When implementing the while-loop in the main function of an NSThread, is it correct to assume it is more efficient on the operating system to run the current run-loop until a specified date rather than just use NSThread sleepUntilDate to

NSRunLoop vs. NSThread sleep

2009-04-28 Thread Eric Hermanson
Hello, When implementing the while-loop in the main function of an NSThread, is it correct to assume it is more efficient on the operating system to run the current run-loop until a specified date rather than just use NSThread sleepUntilDate to obtain the delay? I ask because I don&#

Re: When to release an NSThread instance

2009-03-06 Thread Roland King
;t need to call exit. When an NSThread is started it retains its target object and argument and the thread itself is retained presumably by some subsystem which manages threads. When the task is complete the target object and argument are released and the NSThread is released automa

  1   2   >