Re: grand central dispatch and notification port sources
Re: grand central dispatch and notification port sources
- Subject: Re: grand central dispatch and notification port sources
- From: Damien Sorresso <email@hidden>
- Date: Wed, 10 Mar 2010 15:13:27 -0800
On Mar 10, 2010, at 3:10 PM, Joel Reymont wrote:
> On Mar 10, 2010, at 10:55 PM, Damien Sorresso wrote:
>> Also, it'd be up to you to process the message sent to the port and invoke your callback routine. The structure of the messages sent from IOKit to userspace clients is definitely not public.
>
> What about invoking IODispatchCalloutFromMessage() on the received message to trigger the callback from the GCD handler?
>
> ---
> Dispatches callback notifications from a mach message.
>
> void IODispatchCalloutFromMessage(void *unused, mach_msg_header_t *msg, void *reference );
>
> Parameters:
>
> unused - Not used, set to zero.
> msg - A pointer to the message received.
> reference - Pass the IONotificationPortRef for the object.
>
> Discussion:
>
> A notification object may deliver notifications to a mach messaging client, which should call this function to generate the callbacks associated with the notifications arriving on the port.
That looks like pretty much what you want. Sounds like it'll handle all the message demuxing and dispatching. I didn't know IOKit exported that or even guaranteed that they were using Mach under the covers. Give it a shot to verify.
Dequeuing the message from the port is left as an exercise for the reader.
--
Damien Sorresso
BSD Engineering
Apple Inc.
_______________________________________________
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