• 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
Background threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Background threads


  • Subject: Background threads
  • From: "Al Ameen Shah Ahamed Shah" <email@hidden>
  • Date: Thu, 17 Oct 2002 17:06:45 +0530

Hi,

in the documentation for NSFileHandle one can find the method
"waitForDataInBackgroundAndNotify."
This method waits for new data to arrive in the file and calls a
notification when it arrives, if I'm correct.
The documentation says this happens in a background thread.
I installed a notification for "NSWillBecomeMultiThreadedNotification."
So i expect a call to my notification
procedure after the call "[fileHandle
waitForDataInBackgroundAndNotify]" since it spawns a new thread.
But this does not happen. Please find the code below

- (id) init
{
NSFileHandle *readHandle;

self = [super init];
mReadPipe = [[NSPipe alloc] init];
mWritePipe = [[NSPipe alloc] init];
mProcessInfo = [[NSProcessInfo processInfo] retain];
readHandle = [mReadPipe fileHandleForReading];
[[NSNotificationCenter defaultCenter] addObserver:self

selector:@selector(DidBecomeMultiThreaded:)

name:NSWillBecomeMultiThreadedNotification
object:nil];
[readHandle waitForDataInBackgroundAndNotify]; //This call i
believe spawns a new thread internally.
return self;
}

- (void) DidBecomeMultiThreaded:(NSNotification *)inValue
{
NSLog(@"\nBecame Multi threaded.");
}

Does this mean background threads wont post this notification or does
it mean
waitForDataInBackgroundAndNotify does not create a thread..please help..

thanks in advance,
ameen.
_______________________________________________
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.

  • Follow-Ups:
    • Re: Background threads
      • From: Andreas Mayer <email@hidden>
References: 
 >Re: Declarations near usage (From: Lance Bland <email@hidden>)

  • Prev by Date: NSSplitView query
  • Next by Date: Re: Mouse Event Handling
  • Previous by thread: Re: Declarations near usage
  • Next by thread: Re: Background threads
  • Index(es):
    • Date
    • Thread