Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Ejecting a volume in seperate thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ejecting a volume in seperate thread



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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.