1 #include <darwintest.h>
3 #include <sys/syscall.h>
6 #include <mach/mach_init.h>
7 #include <mach/mach_port.h>
8 #include <mach/mk_timer.h>
11 #define die(w) errx(1, (w))
12 #define edie(w) err(1, (w))
13 #define expect(e) if (-1 == (e)) edie(#e)
19 mk_timer_destroy(*(mach_port_t
*)data
);
25 T_DECL(thread_call_race_71455282
,
27 T_META_IGNORECRASHES(".*thread_call_race_71455282.*"))
29 mach_port_t timer
= MACH_PORT_NULL
;
33 /* we will violate mach rules so ignore crashes here */
34 T_ASSERT_MACH_SUCCESS(task_set_exc_guard_behavior(mach_task_self(), 0),
35 "task_set_exc_guard_behavior");
37 for (n
= 0; n
< 4; ++n
) {
38 T_ASSERT_POSIX_SUCCESS(pthread_create(&t
, NULL
, racer
, &timer
),
43 for (size_t i
= 0; i
< 1000; i
++) {
44 timer
= mk_timer_create();
45 mk_timer_arm(timer
, 1);
46 mk_timer_destroy(timer
);
47 timer
= MACH_PORT_NULL
;
50 T_PASS("didn't panic");