void hlt_execution_context_delete(hlt_execution_context* ctx) { hlt_exception* excpt = 0; // Do this first, it may still need the context. hlt_timer_mgr_expire(ctx->tmgr, 0, &excpt, ctx); GC_DTOR(ctx->tmgr, hlt_timer_mgr, ctx); __hlt_globals_dtor(ctx); GC_DTOR(ctx->excpt, hlt_exception, ctx); if ( ctx->fiber ) hlt_fiber_delete(ctx->fiber, ctx); if ( ctx->pstate ) __hlt_profiler_state_delete(ctx->pstate); if ( ctx->tcontext ) { GC_DTOR_GENERIC(&ctx->tcontext, ctx->tcontext_type, ctx); } __hlt_fiber_pool_delete(ctx->fiber_pool); if ( ctx->nullbuffer ) __hlt_memory_nullbuffer_delete(ctx->nullbuffer, ctx); hlt_free(ctx); }
void __hlt_fiber_done() { if ( ! hlt_is_multi_threaded() ) return; __hlt_fiber_pool_delete(__hlt_globals()->synced_fiber_pool); if ( hlt_is_multi_threaded() && pthread_mutex_destroy(&__hlt_globals()->synced_fiber_pool_lock) != 0 ) fatal_error("cannot destroy mutex"); }