7 #include "testthreadcall.h"
9 #include <kern/thread_call.h>
11 #define super IOService
12 OSDefineMetaClassAndStructors(testthreadcall
, super
);
16 static void thread_call_test_func(thread_call_param_t param0
,
17 thread_call_param_t param1
);
22 testthreadcall::start( IOService
* provider
)
27 IOLog("%s\n", __PRETTY_FUNCTION__
);
29 if (!super::start(provider
)) {
33 IOLog("Attempting thread_call_allocate\n");
34 tcall
= thread_call_allocate(thread_call_test_func
, this);
35 IOLog("thread_call_t %p\n", tcall
);
37 tlock
= IOSimpleLockAlloc();
38 IOLog("tlock %p\n", tlock
);
40 clock_interval_to_deadline(5, NSEC_PER_SEC
, &deadline
);
41 IOLog("%d sec deadline is %llu\n", 5, deadline
);
43 ret
= thread_call_enter_delayed(tcall
, deadline
);
48 static void thread_call_test_func(thread_call_param_t param0
,
49 thread_call_param_t param1
)
51 testthreadcall
*self
= (testthreadcall
*)param0
;
53 IOLog("thread_call_test_func %p %p\n", param0
, param1
);
55 IOSimpleLockLock(self
->tlock
);
56 IOSimpleLockUnlock(self
->tlock
);
59 IOSimpleLockLock(self
->tlock
);
61 IOSimpleLockUnlock(self
->tlock
);