| 382 | } |
| 383 | |
| 384 | bthread_t bthread_self(void) { |
| 385 | bthread::TaskGroup* g = bthread::tls_task_group; |
| 386 | // note: return 0 for main tasks now, which include main thread and |
| 387 | // all work threads. So that we can identify main tasks from logs |
| 388 | // more easily. This is probably questionable in the future. |
| 389 | if (g != NULL && !g->is_current_main_task()/*note*/) { |
| 390 | return g->current_tid(); |
| 391 | } |
| 392 | return INVALID_BTHREAD; |
| 393 | } |
| 394 | |
| 395 | int bthread_equal(bthread_t t1, bthread_t t2) { |
| 396 | return t1 == t2; |