• 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
Using NSThread (was: console output -> NSTextView)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Using NSThread (was: console output -> NSTextView)


  • Subject: Using NSThread (was: console output -> NSTextView)
  • From: Koen van der Drift <email@hidden>
  • Date: Sun, 30 May 2004 20:07:30 -0400

Hi,

Using the suggestion from a posting I found in the archives, I was able to direct the output to an NSTextView. However, the output wouldn't display until all the calculations were done. So after some Googling, I found that using NSThread could help me here.

This is what I do now:

-(IBAction)start:(id)sender
{
[NSThread detachNewThreadSelector: @selector(run:)
toTarget: self withObject: nil];
}

-(void)run:(id)sender
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

Run();

[pool release];
}


Where Run() is the method in the original source code that does all the work. Indeed the calls to myPrintf now appear immediately on the screen. I would like to know if this is indeed the proper way to use an NSThread. Did I miss anything?


thanks,

- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >console output -> NSTextView (From: Koen van der Drift <email@hidden>)
 >Re: console output -> NSTextView (From: Scott Anguish <email@hidden>)

  • Prev by Date: Adding a new row to a NSTextView for editing (user input).
  • Next by Date: Re: Class Constants
  • Previous by thread: Re: console output -> NSTextView
  • Next by thread: PDF Title with Quartz
  • Index(es):
    • Date
    • Thread