Re: Unmount using DADiskUnmount
Re: Unmount using DADiskUnmount
- Subject: Re: Unmount using DADiskUnmount
- From: "Rakesh Singhal" <email@hidden>
- Date: Thu, 15 Jan 2009 12:34:30 +0530
Hi Dan,
Thanks. Now I called the CFRunLoopRun() and it is working fine. Still
I have one thing to know that when my pendrive is busy then it is
taking around 5-8 seconds to call the callback function. I think this
interval is very high. Is there anyway to call callback method to be
called immediately?
Regards
rksinghal
On Thu, Jan 15, 2009 at 11:42 AM, Rakesh Singhal
<email@hidden> wrote:
> 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 <email@hidden> 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 (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden