Ejecting a volume in seperate thread
Ejecting a volume in seperate thread
- Subject: Ejecting a volume in seperate thread
- From: alon b <email@hidden>
- Date: Sat, 28 Jun 2003 10:33:47 -0700 (PDT)
I am trying to eject a volume, my code (the Eject function) works fine when running in the main application thread but when called through NSConnection from on a "work" thread the function never returns i.e. NSBeep is never reached. Any ideas ?
@implementation SDKServer
- (oneway void)Eject
{
pid_t pid;
FSVolumeRefNum actualVolume = xxx; //xxx is the actual volume number
OSErr result = FSEjectVolumeSync(actualVolume, 0, &pid);
NSBeep();
}
+ (void)connectWithPorts:(NSArray *)portArray
{
NSAutoreleasePool *pool;
NSConnection *connectionToController;
ETSDKServer *serverObject;
pool = [[NSAutoreleasePool alloc] init];
connectionToController = [NSConnection connectionWithReceivePort:[portArray objectAtIndex:0]
sendPort:[portArray objectAtIndex:1]];
serverObject = [[self alloc] init];
id client = [connectionToController rootProxy];
[client SetServer:serverObject];
[serverObject release];
[[NSRunLoop currentRunLoop] run];
[pool release];
}
@end
Thanx
Alonb
SBC Yahoo! DSL - Now only $29.95 per month!
_______________________________________________
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.