- if (option & MACH_SEND_TIMEOUT)
- thread_set_timer(timeout, 1000*NSEC_PER_USEC);
-
- counter(c_ipc_mqueue_send_block++);
- save_wait_result = thread_block((void (*)(void)) 0);
+ if (wresult == THREAD_WAITING) {
+ if (option & MACH_SEND_TIMEOUT) {
+ thread_set_timer(timeout, 1000*NSEC_PER_USEC);
+ wresult = thread_block(THREAD_CONTINUE_NULL);
+ if (wresult != THREAD_TIMED_OUT)
+ thread_cancel_timer();
+ } else {
+ wresult = thread_block(THREAD_CONTINUE_NULL);
+ }
+ counter(c_ipc_mqueue_send_block++);
+ }