/* ===== tls_exiting_procs ======================================================== PUBLIC. ================================================================================ */ status_t tls_exiting_procs () { thread_id id = find_thread (NULL) ; _tls_thread_entry_t* e = NULL ; status_t status ; // Search for the thread entry. if ((status = tls_entries_mutex_p ()) == B_NO_ERROR) { status = tls_get_entry (id, &e) ; tls_entries_mutex_v () ; } // If the thread has no entry, then we should not call its exit procs. if (status == B_NAME_NOT_FOUND) return B_NO_ERROR ; // Other errors are... errors. if (status != B_NO_ERROR) return status ; // Free the entry structure (avoid monitoring thread to have to do this at // a bad time, in a bad thread). The entry deletion function will automatically // call exiting procs. if ((status = tls_entries_mutex_p ()) == B_NO_ERROR) { status = tls_delete_entry (e) ; tls_entries_mutex_v () ; } // Finish. return status ; }
/* ===== tls_delete_entry_thread_id =============================================== PRIVATE. ================================================================================ */ status_t tls_delete_entry_thread_id (thread_id id) { _tls_thread_entry_t* pEntry = NULL ; status_t status ; if ((status = tls_get_entry (id, &pEntry)) != B_NO_ERROR) return status ; return tls_delete_entry (pEntry) ; }