[libdispatch-changes] [129] trunk/src/source.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 4 11:28:09 PST 2009
Revision: 129
http://trac.macosforge.org/projects/libdispatch/changeset/129
Author: dsteffen at apple.com
Date: 2009-11-04 11:28:06 -0800 (Wed, 04 Nov 2009)
Log Message:
-----------
remove usage of legacy dispatch API from non-legacy code
Modified Paths:
--------------
trunk/src/source.c
Modified: trunk/src/source.c
===================================================================
--- trunk/src/source.c 2009-11-04 18:37:02 UTC (rev 128)
+++ trunk/src/source.c 2009-11-04 19:28:06 UTC (rev 129)
@@ -1839,20 +1839,26 @@
#endif /* DISPATCH_NO_LEGACY */
static void
-_dispatch_mach_notify_source_init(void *context __attribute__((unused)))
+_dispatch_mach_notify_source2(void *context)
{
- size_t maxsz = sizeof(union __RequestUnion___dispatch_send_libdispatch_internal_protocol_subsystem);
+ dispatch_source_t ds = context;
+ const size_t maxsz = MAX(
+ sizeof(union __RequestUnion___dispatch_send_libdispatch_internal_protocol_subsystem),
+ sizeof(union __ReplyUnion___dispatch_libdispatch_internal_protocol_subsystem));
- if (sizeof(union __ReplyUnion___dispatch_libdispatch_internal_protocol_subsystem) > maxsz) {
- maxsz = sizeof(union __ReplyUnion___dispatch_libdispatch_internal_protocol_subsystem);
- }
+ dispatch_mig_server(ds, maxsz, libdispatch_internal_protocol_server);
+}
+static void
+_dispatch_mach_notify_source_init(void *context __attribute__((unused)))
+{
_dispatch_get_port_set();
- _dispatch_mach_notify_source = dispatch_source_mig_create(_dispatch_event_port,
- maxsz, NULL, &_dispatch_mgr_q, libdispatch_internal_protocol_server);
-
+ _dispatch_mach_notify_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MACH_RECV, _dispatch_event_port, 0, &_dispatch_mgr_q);
dispatch_assert(_dispatch_mach_notify_source);
+ dispatch_set_context(_dispatch_mach_notify_source, _dispatch_mach_notify_source);
+ dispatch_source_set_event_handler_f(_dispatch_mach_notify_source, _dispatch_mach_notify_source2);
+ dispatch_resume(_dispatch_mach_notify_source);
}
kern_return_t
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20091104/b80d96d7/attachment-0001.html>
More information about the libdispatch-changes
mailing list