Changeset fc10e1b in mainline for kernel/test/thread/thread1.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/thread/thread1.c

    r508b0df1 rfc10e1b  
    4646        thread_detach(THREAD);
    4747
    48         while (atomic_get(&finish)) {
     48        while (atomic_load(&finish)) {
    4949                TPRINTF("%" PRIu64 " ", THREAD->tid);
    5050                thread_usleep(100000);
     
    5656{
    5757        unsigned int i;
    58         atomic_count_t total = 0;
     58        size_t total = 0;
    5959
    60         atomic_set(&finish, 1);
    61         atomic_set(&threads_finished, 0);
     60        atomic_store(&finish, 1);
     61        atomic_store(&threads_finished, 0);
    6262
    6363        for (i = 0; i < THREADS; i++) {
     
    7575        thread_sleep(10);
    7676
    77         atomic_set(&finish, 0);
    78         while (atomic_get(&threads_finished) < total) {
    79                 TPRINTF("Threads left: %" PRIua "\n", total - atomic_get(&threads_finished));
     77        atomic_store(&finish, 0);
     78        while (atomic_load(&threads_finished) < total) {
     79                TPRINTF("Threads left: %zu\n", total - atomic_load(&threads_finished));
    8080                thread_sleep(1);
    8181        }
Note: See TracChangeset for help on using the changeset viewer.