| 342 | } |
| 343 | |
| 344 | int bthread_start_background(bthread_t* __restrict tid, |
| 345 | const bthread_attr_t* __restrict attr, |
| 346 | void * (*fn)(void*), |
| 347 | void* __restrict arg) { |
| 348 | bthread::TaskGroup* g = bthread::tls_task_group; |
| 349 | if (g) { |
| 350 | // if attribute is null use thread local task group |
| 351 | if (bthread::can_run_thread_local(attr)) { |
| 352 | return g->start_background<false>(tid, attr, fn, arg); |
| 353 | } |
| 354 | } |
| 355 | return bthread::start_from_non_worker(tid, attr, fn, arg); |
| 356 | } |
| 357 | |
| 358 | void bthread_flush() { |
| 359 | bthread::TaskGroup* g = bthread::tls_task_group; |