]>
git.saurik.com Git - apple/libdispatch.git/blob - testing/dispatch_deadname.c
1 #include <dispatch/dispatch.h>
8 #include "dispatch_test.h"
13 test_start("Dispatch dead-name notification");
15 dispatch_async(dispatch_get_concurrent_queue(0), ^{
16 mach_port_t mp
= pthread_mach_thread_np(pthread_self());
17 dispatch_source_t ds0
;
22 kr
= mach_port_mod_refs(mach_task_self(), mp
, MACH_PORT_RIGHT_SEND
, 1);
26 ds0
= dispatch_source_machport_create(mp
, DISPATCH_MACHPORT_DEAD
, NULL
, dispatch_get_main_queue(),
27 ^(dispatch_event_t de
) {
28 dispatch_release(dispatch_event_get_source(de
));
33 test_ptr_notnull("dispatch_source_machport_create", ds0
);
35 // give the mgr queue time to start, otherwise the mgr queue will run
36 // on this thread, thus defeating the test which assumes that this