예제 #1
0
파일: context.c 프로젝트: rsmmr/hilti
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);
}
예제 #2
0
파일: fiber.c 프로젝트: Chunjie/hilti
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");
}