Changeset 8565a42 in mainline for kernel/generic/src/synch/futex.c


Ignore:
Timestamp:
2018-03-02T20:34:50Z (7 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/futex.c

    r3061bc1 r8565a42  
    157157{
    158158        task->futexes = malloc(sizeof(struct futex_cache), 0);
    159        
     159
    160160        cht_create(&task->futexes->ht, 0, 0, 0, true, &task_futex_ht_ops);
    161        
     161
    162162        list_initialize(&task->futexes->list);
    163163        spinlock_initialize(&task->futexes->list_lock, "futex-list-lock");
     
    183183        struct futex_cache *cache =
    184184                member_to_inst(work, struct futex_cache, destroy_work);
    185        
     185
    186186        /*
    187187         * Destroy the cache before manually freeing items of the cache in case
     
    189189         */
    190190        cht_destroy_unsafe(&cache->ht);
    191        
     191
    192192        /* Manually free futex_ptr cache items. */
    193193        list_foreach_safe(cache->list, cur_link, next_link) {
     
    197197                free(fut_ptr);
    198198        }
    199        
     199
    200200        free(cache);
    201201}
     
    205205{
    206206        struct futex_cache *futexes = TASK->futexes;
    207        
     207
    208208        /* All threads of this task have terminated. This is the last thread. */
    209209        spinlock_lock(&futexes->list_lock);
    210        
     210
    211211        list_foreach_safe(futexes->list, cur_link, next_link) {
    212212                futex_ptr_t *fut_ptr = member_to_inst(cur_link, futex_ptr_t, all_link);
     
    222222                futex_release_ref_locked(fut_ptr->futex);
    223223        }
    224        
     224
    225225        spinlock_unlock(&futexes->list_lock);
    226226}
     
    252252        assert(spinlock_locked(&futex_ht_lock));
    253253        assert(0 < futex->refcount);
    254        
     254
    255255        --futex->refcount;
    256        
     256
    257257        if (0 == futex->refcount) {
    258258                hash_table_remove(&futex_ht, &futex->paddr);
     
    272272{
    273273        futex_t *futex = find_cached_futex(uaddr);
    274        
     274
    275275        if (futex)
    276276                return futex;
     
    303303                    (uaddr - ALIGN_DOWN(uaddr, PAGE_SIZE));
    304304        }
    305        
     305
    306306        spinlock_unlock(&futex_ht_lock);
    307307        page_table_unlock(AS, false);
    308        
     308
    309309        return success;
    310310}
     
    314314{
    315315        cht_read_lock();
    316        
     316
    317317        futex_t *futex;
    318318        cht_link_t *futex_ptr_link = cht_find_lazy(&TASK->futexes->ht, &uaddr);
     
    321321                futex_ptr_t *futex_ptr
    322322                        = member_to_inst(futex_ptr_link, futex_ptr_t, cht_link);
    323                
     323
    324324                futex = futex_ptr->futex;
    325325        } else {
    326326                futex = NULL;
    327327        }
    328        
     328
    329329        cht_read_unlock();
    330        
     330
    331331        return futex;
    332332}
     
    340340{
    341341        futex_t *futex = malloc(sizeof(futex_t), 0);
    342        
     342
    343343        /*
    344344         * Find the futex object in the global futex table (or insert it
     
    346346         */
    347347        spinlock_lock(&futex_ht_lock);
    348        
     348
    349349        ht_link_t *fut_link = hash_table_find(&futex_ht, &phys_addr);
    350        
     350
    351351        if (fut_link) {
    352352                free(futex);
     
    357357                hash_table_insert(&futex_ht, &futex->ht_link);
    358358        }
    359        
     359
    360360        spinlock_unlock(&futex_ht_lock);
    361        
     361
    362362        /*
    363363         * Cache the link to the futex object for this task.
     
    365365        futex_ptr_t *fut_ptr = malloc(sizeof(futex_ptr_t), 0);
    366366        cht_link_t *dup_link;
    367        
     367
    368368        fut_ptr->futex = futex;
    369369        fut_ptr->uaddr = uaddr;
    370        
     370
    371371        cht_read_lock();
    372        
     372
    373373        /* Cache the mapping from the virtual address to the futex for this task. */
    374374        if (cht_insert_unique(&TASK->futexes->ht, &fut_ptr->cht_link, &dup_link)) {
     
    380380                free(fut_ptr);
    381381                futex_release_ref_locked(futex);
    382                
     382
    383383                futex_ptr_t *dup = member_to_inst(dup_link, futex_ptr_t, cht_link);
    384384                futex = dup->futex;
     
    386386
    387387        cht_read_unlock();
    388        
     388
    389389        return futex;
    390390}
     
    401401{
    402402        futex_t *futex = get_futex(uaddr);
    403        
     403
    404404        if (!futex)
    405405                return (sys_errno_t) ENOENT;
     
    428428{
    429429        futex_t *futex = get_futex(uaddr);
    430        
     430
    431431        if (futex) {
    432432                waitq_wakeup(&futex->wq, WAKEUP_FIRST);
     
    492492        const futex_ptr_t *fut_ptr1 = member_to_inst(item1, futex_ptr_t, cht_link);
    493493        const futex_ptr_t *fut_ptr2 = member_to_inst(item2, futex_ptr_t, cht_link);
    494        
     494
    495495        return fut_ptr1->uaddr == fut_ptr2->uaddr;
    496496}
     
    500500        const futex_ptr_t *fut_ptr = member_to_inst(item, futex_ptr_t, cht_link);
    501501        uintptr_t uaddr = *(uintptr_t*)key;
    502        
     502
    503503        return fut_ptr->uaddr == uaddr;
    504504}
Note: See TracChangeset for help on using the changeset viewer.