static void thr_exit_cleanup(ethr_tid *tid, void *res) { ETHR_ASSERT(tid == ETHR_GET_OWN_TID__); if (tid->jdata) tid->jdata->res = res; ethr_run_exit_handlers__(); ethr_ts_event_destructor__((void *) ethr_get_tse__()); }
int ethr_get_main_thr_status(int *on) { ethr_ts_event *tsep = ethr_get_tse__(); if (!tsep) *on = 0; else { if (tsep->iflgs & ETHR_TS_EV_MAIN_THR) *on = 1; else *on = 0; } return 0; }
int ethr_set_main_thr_status(int on, int no) { ethr_ts_event *tsep = ethr_get_tse__(); if (!tsep) return EINVAL; if (on) { if (no < 1 || main_threads < no) return EINVAL; tsep->mtix = (unsigned short) no; tsep->iflgs |= ETHR_TS_EV_MAIN_THR; } else { tsep->iflgs &= ~ETHR_TS_EV_MAIN_THR; tsep->mtix = (unsigned short) 0; } return 0; }