6 #include <dispatch/dispatch.h>
8 #include "test_support.h"
10 int main(int argc
, const char* argv
[], const char* envp
[], const char* apple
[]) {
11 signal(SIGUSR1
, SIG_IGN
);
12 dispatch_source_t signalSource
= dispatch_source_create(DISPATCH_SOURCE_TYPE_PROC
, getppid(),
13 DISPATCH_PROC_EXIT
, dispatch_get_main_queue());
14 dispatch_source_set_event_handler(signalSource
, ^{
17 dispatch_resume(signalSource
);
19 dispatch_async(dispatch_get_main_queue(), ^{
20 LOG("target starting");
22 // load and unload in a loop
23 for (int i
=1; i
< 10000; ++i
) {
24 void* h
= dlopen("./libfoo.dylib", 0);
25 usleep(100000/(i
*100));