Changeset fc10e1b in mainline for kernel/test/synch/semaphore1.c


Ignore:
Timestamp:
2018-09-07T16:34:11Z (7 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:
d2c91ab
Parents:
508b0df1 (diff), e90cfa6 (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.
Message:

Merge branch 'atomic'

Use more of <stdatomic.h> in kernel. Increment/decrement macros kept because
the are handy. atomic_t currently kept because I'm way too lazy to go through
all uses and think about the most appropriate replacement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/synch/semaphore1.c

    r508b0df1 rfc10e1b  
    7373{
    7474        int i, j, k;
    75         atomic_count_t consumers;
    76         atomic_count_t producers;
     75        size_t consumers;
     76        size_t producers;
    7777
    7878        waitq_initialize(&can_start);
     
    8282                thread_t *thrd;
    8383
    84                 atomic_set(&items_produced, 0);
    85                 atomic_set(&items_consumed, 0);
     84                atomic_store(&items_produced, 0);
     85                atomic_store(&items_consumed, 0);
    8686
    8787                consumers = i * CONSUMERS;
    8888                producers = (4 - i) * PRODUCERS;
    8989
    90                 TPRINTF("Creating %" PRIua " consumers and %" PRIua " producers...",
     90                TPRINTF("Creating %zu consumers and %zu producers...",
    9191                    consumers, producers);
    9292
     
    115115                waitq_wakeup(&can_start, WAKEUP_ALL);
    116116
    117                 while ((items_consumed.count != consumers) || (items_produced.count != producers)) {
    118                         TPRINTF("%" PRIua " consumers remaining, %" PRIua " producers remaining\n",
    119                             consumers - items_consumed.count, producers - items_produced.count);
     117                while ((items_consumed != consumers) || (items_produced != producers)) {
     118                        TPRINTF("%zu consumers remaining, %zu producers remaining\n",
     119                            consumers - items_consumed, producers - items_produced);
    120120                        thread_sleep(1);
    121121                }
Note: See TracChangeset for help on using the changeset viewer.