| 511 | } |
| 512 | |
| 513 | int bthread_about_to_quit() { |
| 514 | bthread::TaskGroup* g = bthread::tls_task_group; |
| 515 | if (g != NULL) { |
| 516 | bthread::TaskMeta* current_task = g->current_task(); |
| 517 | if(!(current_task->attr.flags & BTHREAD_NEVER_QUIT)) { |
| 518 | current_task->about_to_quit = true; |
| 519 | } |
| 520 | return 0; |
| 521 | } |
| 522 | return EPERM; |
| 523 | } |
| 524 | |
| 525 | int bthread_timer_add(bthread_timer_t* id, timespec abstime, |
| 526 | void (*on_timer)(void*), void* arg) { |