Background threads
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.