예제 #1
0
void interface5::internal::task_base::destroy( task& victim ) {
    __TBB_ASSERT( victim.prefix().ref_count== (ConcurrentWaitsEnabled(victim) ? 1 : 0), "Task being destroyed must not have children" );
    __TBB_ASSERT( victim.state()==task::allocated, "illegal state for victim task" );
    task* parent = victim.parent();
    victim.~task();
    if( parent ) {
        __TBB_ASSERT( parent->state()==task::allocated, "attempt to destroy child of running or corrupted parent?" );
        parent->internal_decrement_ref_count();
        // Despite last reference to *parent removed, it should not be destroyed (documented behavior).
    }
    governor::local_scheduler()->free_task<no_hint>( victim );
}
예제 #2
0
void interface5::internal::task_base::destroy( task& victim ) {
    // 1 may be a guard reference for wait_for_all, which was not reset because
    // of concurrent_wait mode or because prepared root task was not actually used
    // for spawning tasks (as in structured_task_group).
    __TBB_ASSERT( (intptr_t)victim.prefix().ref_count <= 1, "Task being destroyed must not have children" );
    __TBB_ASSERT( victim.state()==task::allocated, "illegal state for victim task" );
    task* parent = victim.parent();
    victim.~task();
    if( parent ) {
        __TBB_ASSERT( parent->state()==task::allocated, "attempt to destroy child of running or corrupted parent?" );
        parent->internal_decrement_ref_count();
        // Even if the last reference to *parent is removed, it should not be spawned (documented behavior).
    }
    governor::local_scheduler()->free_task<no_hint>( victim );
}
예제 #3
0
void allocate_continuation_proxy::free( task& mytask ) const {
    // Restore the parent as it was before the corresponding allocate was called.
    ((task*)this)->prefix().parent = mytask.parent();
    governor::local_scheduler()->free_task<local_task>(mytask);
}