src/libty/task.c
static int start_worker_thread(ty_pool *pool)
{
    ty_thread *thread;
    int r;

    // Can't handle failure after ty_thread_create() so grow the array first
    r = _hs_array_grow(&pool->worker_threads, 1);
    if (r < 0)
        return ty_libhs_translate_error(r);
    thread = &pool->worker_threads.values[pool->worker_threads.count];

    r = ty_thread_create(thread, worker_thread_main, pool);
    if (r < 0)
        return r;

    pool->worker_threads.count++;
    pool->busy_workers++;

    return 0;
}
// Call with pool->mutex locked
Call with pool->mutex locked
Call with pool - > mutex locked
static int start_worker_thread(ty_pool *pool)
{
    ty_thread *thread;
    int r;
    r = _hs_array_grow(&pool->worker_threads, 1);
    if (r < 0)
        return ty_libhs_translate_error(r);
    thread = &pool->worker_threads.values[pool->worker_threads.count];
    r = ty_thread_create(thread, worker_thread_main, pool);
    if (r < 0)
        return r;
    pool->worker_threads.count++;
    pool->busy_workers++;
    return 0;
}
static int start_worker_thread ( ty_pool * pool ) { ty_thread * thread ; int r ; r = _hs_array_grow ( & pool -> worker_threads , 1 ) ; if ( r < 0 ) return ty_libhs_translate_error ( r ) ; thread = & pool -> worker_threads . values [ pool -> worker_threads . count ] ; r = ty_thread_create ( thread , worker_thread_main , pool ) ; if ( r < 0 ) return r ; pool -> worker_threads . count ++ ; pool -> busy_workers ++ ; return 0 ; }
Call with pool->mutex locked
Call with pool - > mutex locked
// Can't handle failure after ty_thread_create() so grow the array first