示例#1
0
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;
}
示例#2
0
文件: market.cpp 项目: fifield/skir
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;
}
示例#3
0
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;
}