| 402 | } |
| 403 | |
| 404 | enum cb_err thread_join(struct thread_handle *handle) |
| 405 | { |
| 406 | struct stopwatch sw; |
| 407 | struct thread *current = current_thread(); |
| 408 | |
| 409 | assert(handle); |
| 410 | assert(current); |
| 411 | assert(current->handle != handle); |
| 412 | |
| 413 | if (handle->state == THREAD_UNINITIALIZED) |
| 414 | return CB_ERR_ARG; |
| 415 | |
| 416 | printk(BIOS_SPEW, "waiting for thread\n"); |
| 417 | |
| 418 | stopwatch_init(&sw); |
| 419 | |
| 420 | while (handle->state != THREAD_DONE) |
| 421 | assert(thread_yield() == 0); |
| 422 | |
| 423 | printk(BIOS_SPEW, "took %lld us\n", stopwatch_duration_usecs(&sw)); |
| 424 | |
| 425 | return handle->error; |
| 426 | } |
| 427 | |
| 428 | void thread_mutex_lock(struct thread_mutex *mutex) |
| 429 | { |
no test coverage detected