• 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
thread communication ... with a little problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

thread communication ... with a little problem


  • Subject: thread communication ... with a little problem
  • From: Yorh <email@hidden>
  • Date: Tue, 18 Apr 2006 10:39:42 +0200

Hi to all,

I have a little problem with a worker thread in my app.
I have a NSWindowController class, inside it (when the window is started) a new thread starts in a for (; ; ) infinite loop.
I need to stop the thread when the window is closed.
I added a new method:


-(BOOL)windowShouldClose
{
// I should exit the thread here
}

but if I type [NSThread exit] the app of course crashes because NSThread is the main thread and not the new worker one.
I need something to close the worker thread started in another method :


-(void)loopThread
{
NSAutoreleasePool * thePool = [[NSAutoreleasePool alloc]init];

	for (; ;){


} [thePool release];

}

I tried to use an accessor method to return NSThread object but it doesn't work and the notification system isn't the right way to do it (I think).
Any idea?


Thank you all for your always kind support
Yorh

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: thread communication ... with a little problem
      • From: Christian Stieber <email@hidden>
  • Prev by Date: Re: Cocoa Books
  • Next by Date: Re: Cocoa Books
  • Previous by thread: Focus in NSPanel
  • Next by thread: Re: thread communication ... with a little problem
  • Index(es):
    • Date
    • Thread