| 1460 | } |
| 1461 | } |
| 1462 | void thread_interrupt(thread* th, int error_number) |
| 1463 | { |
| 1464 | if (unlikely(!th)) |
| 1465 | LOG_ERROR_RETURN(EINVAL, , "invalid parameter"); |
| 1466 | auto state = th->state; |
| 1467 | if (unlikely(state != states::SLEEPING)) { |
| 1468 | out: // may have thread_yield()-ed |
| 1469 | if (state == states::READY && th->error_number == 0) |
| 1470 | th->error_number = error_number; |
| 1471 | return; |
| 1472 | } |
| 1473 | SCOPED_LOCK(th->lock); |
| 1474 | state = th->state; |
| 1475 | if (unlikely(state != states::SLEEPING)) goto out; |
| 1476 | |
| 1477 | prelocked_thread_interrupt(th, error_number); |
| 1478 | } |
| 1479 | |
| 1480 | static void do_stack_pages_gc(void* arg) { |
| 1481 | #if !defined(_WIN64) && !defined(__aarch64__) |