Changeset 38e3427 in mainline


Ignore:
Timestamp:
2018-06-25T21:51:37Z (6 years ago)
Author:
Jiří Zárevúcky <jiri.zarevucky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f6372be9
Parents:
95838f1
git-author:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 21:03:47)
git-committer:
Jiří Zárevúcky <jiri.zarevucky@…> (2018-06-25 21:51:37)
Message:

Switch other up/down to lock/unlock.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/rcu.c

    r95838f1 r38e3427  
    172172        assert(!fibril_rcu.registered);
    173173
    174         futex_down(&rcu.list_futex);
     174        futex_lock(&rcu.list_futex);
    175175        list_append(&fibril_rcu.link, &rcu.fibrils_list);
    176         futex_up(&rcu.list_futex);
     176        futex_unlock(&rcu.list_futex);
    177177
    178178        fibril_rcu.registered = true;
     
    197197        fibril_rcu.nesting_cnt = 0;
    198198
    199         futex_down(&rcu.list_futex);
     199        futex_lock(&rcu.list_futex);
    200200        list_remove(&fibril_rcu.link);
    201         futex_up(&rcu.list_futex);
     201        futex_unlock(&rcu.list_futex);
    202202
    203203        fibril_rcu.registered = false;
     
    334334static void wait_for_readers(size_t reader_group)
    335335{
    336         futex_down(&rcu.list_futex);
     336        futex_lock(&rcu.list_futex);
    337337
    338338        list_t quiescent_fibrils;
     
    345345
    346346                        if (is_preexisting_reader(fib, reader_group)) {
    347                                 futex_up(&rcu.list_futex);
     347                                futex_unlock(&rcu.list_futex);
    348348                                sync_sleep();
    349                                 futex_down(&rcu.list_futex);
     349                                futex_lock(&rcu.list_futex);
    350350                                /* Break to while loop. */
    351351                                break;
     
    358358
    359359        list_concat(&rcu.fibrils_list, &quiescent_fibrils);
    360         futex_up(&rcu.list_futex);
     360        futex_unlock(&rcu.list_futex);
    361361}
    362362
    363363static void lock_sync(void)
    364364{
    365         futex_down(&rcu.sync_lock.futex);
     365        futex_lock(&rcu.sync_lock.futex);
    366366        if (rcu.sync_lock.locked) {
    367367                blocked_fibril_t blocked_fib;
     
    372372                do {
    373373                        blocked_fib.is_ready = false;
    374                         futex_up(&rcu.sync_lock.futex);
     374                        futex_unlock(&rcu.sync_lock.futex);
    375375                        fibril_switch(FIBRIL_TO_MANAGER);
    376                         futex_down(&rcu.sync_lock.futex);
     376                        futex_lock(&rcu.sync_lock.futex);
    377377                } while (rcu.sync_lock.locked);
    378378
     
    394394        if (0 < rcu.sync_lock.blocked_thread_cnt) {
    395395                --rcu.sync_lock.blocked_thread_cnt;
    396                 futex_up(&rcu.sync_lock.futex_blocking_threads);
     396                futex_unlock(&rcu.sync_lock.futex_blocking_threads);
    397397        } else {
    398398                /* Unlock but wake up any fibrils waiting for the lock. */
     
    409409
    410410                rcu.sync_lock.locked = false;
    411                 futex_up(&rcu.sync_lock.futex);
     411                futex_unlock(&rcu.sync_lock.futex);
    412412        }
    413413}
     
    420420         * but keep sync locked.
    421421         */
    422         futex_up(&rcu.sync_lock.futex);
     422        futex_unlock(&rcu.sync_lock.futex);
    423423        async_usleep(RCU_SLEEP_MS * 1000);
    424         futex_down(&rcu.sync_lock.futex);
     424        futex_lock(&rcu.sync_lock.futex);
    425425}
    426426
Note: See TracChangeset for help on using the changeset viewer.