user/lib/libc/src/threads/thread_info.c
/**
 * Returns the thread info structure for a thread given its handle.
 */
Returns the thread info structure for a thread given its handle.
Returns the thread info structure for a thread given its handle .
uthread_t *GetThreadInfoBlock(const uintptr_t handle) {
    int err;
    uthread_t query = { .handle = handle  };
    uthread_t *found = NULL;
    err = mtx_lock(&gState.blocksLock);
    if(err != thrd_success) return NULL;
    void *_info = hashmap_get(gState.blocks, &query);
    if(_info) {
        found = (uthread_t *) _info;
        goto beach;
    }
beach:;
    mtx_unlock(&gState.blocksLock);
    return found;
}
uthread_t * GetThreadInfoBlock ( const uintptr_t handle ) { int err ; uthread_t query = { . handle = handle } ; uthread_t * found = NULL ; err = mtx_lock ( & gState . blocksLock ) ; if ( err != thrd_success ) return NULL ; void * _info = hashmap_get ( gState . blocks , & query ) ; if ( _info ) { found = ( uthread_t * ) _info ; goto beach ; } beach : ; mtx_unlock ( & gState . blocksLock ) ; return found ; }
Returns the thread info structure for a thread given its handle.
Returns the thread info structure for a thread given its handle .
// retrieve an existing block if it exists // no info block found