arena& market::create_arena ( unsigned max_num_workers, size_t stack_size ) { market &m = global_market( max_num_workers, stack_size ); // increases market's ref count arena& a = arena::allocate_arena( m, min(max_num_workers, m.my_max_num_workers) ); // Add newly created arena into the existing market's list. arenas_list_mutex_type::scoped_lock lock(m.my_arenas_list_mutex); m.insert_arena_into_list(a); return a; }
arena& market::create_arena ( unsigned max_num_workers, size_t stack_size ) { market &m = global_market( max_num_workers, stack_size ); // increases market's ref count arena& a = arena::allocate_arena( m, min(max_num_workers, m.my_max_num_workers) ); // Add newly created arena into the existing market's list. spin_mutex::scoped_lock lock(m.my_arenas_list_mutex); m.my_arenas.push_front( a ); if ( m.my_arenas.size() == 1 ) m.my_next_arena = m.my_arenas.begin(); return a; }
arena& market::create_arena ( unsigned max_num_workers, size_t stack_size ) { market &m = global_market( max_num_workers, stack_size ); // increases market's ref count #if __TBB_TASK_ARENA // Prevent cutting an extra slot for task_arena(p,0) with default market (p-1 workers). // This is a temporary workaround for 1968 until (TODO:) master slot reservation is reworked arena& a = arena::allocate_arena( m, min(max_num_workers, m.my_max_num_workers+1) ); #else arena& a = arena::allocate_arena( m, min(max_num_workers, m.my_max_num_workers) ); #endif // Add newly created arena into the existing market's list. arenas_list_mutex_type::scoped_lock lock(m.my_arenas_list_mutex); m.insert_arena_into_list(a); return a; }