Re: Unmount using DADiskUnmount
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=FgUtLUPigLNvoR7qyXqDe3Mygq52rx7fobCO4QBz3Bk=; b=RON5K2YA0Sg1PzCuOqTe/8exbcZTbdCe0a763/W8me8NEja9LZX8SGkLuArzoIgzAs aJiimP47ko9sTGZuYGu+3S0T1AguKNsYWNDzFSHABFtKSouelqvo1e57LkSfkN1oUrnK kYpdMkJKLo7PstzZJiRFVX1pLacyApLvDXm4s= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=hLfECz5HkZXTVuKYQIyim5WoGrhspoc0OLTCE/Gk87mK0orbfZl+PQUIk1cbA46rX2 j0goq+plbq5nz4Cwm2gMNagWQBiOFMbrBcLQLLnsc6Y2SY/0Obb4gmFvb1GZslTitzXC eTdDlGcBwLjzdNGG5gTKpbXn2BG/jhNrHaV4Q= Hi Dan, In given code if you see I have called DASessionScheduleWithRunLoop() after DASessionCreate() method. CFRunLoopRun() was called in starting of my code. Does it make any difference if CFRunLoopRun() was called on main thread and unmount functionality is implemented on another thread? In acse of there is no pendrive, my callback function is getting called, thats why I am not able to understand the things. Regards On Thu, Jan 15, 2009 at 11:33 AM, Dan Markarian <markarian@apple.com> wrote:
Hey Rakesh,
You need to schedule the session on a run loop with DASessionScheduleWithRunLoop() and run the run loop with CFRunLoopRun().
Dan
On 14 Jan 2009, at 9:36 PM, Rakesh Singhal wrote:
Hi all,
It is a daemon application, in which I am ejecting a USB pendrive. I am using following code(code to unmount) to unmount it. Now, my callback function is not getting called. It gets called only in one case when there is no pendrive and I call DADiskUnmount.
Please advice me where I am missing something or mistaking.
main() { DADiskRef disk = NULL; DASessionRef session = NULL; session = DASessionCreate ( kCFAllocatorDefault ); if(session == NULL) { return false; } DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); disk = DADiskCreateFromBSDName ( kCFAllocatorDefault, session, diskName); if(disk == NULL) return false;
DADiskUnmount(disk, kDADiskUnmountOptionWhole, CPCSServerSocket::SafeRemovalCallback, NULL); return true; }
void CPCSServerSocket::SafeRemovalCallback( DADiskRef disk, DADissenterRef dissenter, void * context ) { printf("CPCSServerSocket::SafeRemovalCallback disk-%p dissenter-%p\n", disk, dissenter); }
Thanks in advance.
Regards rksinghal _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/markarian%40apple.com
This email sent to markarian@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Rakesh Singhal