Changeset fc10e1b in mainline for kernel/generic/src/adt/cht.c


Ignore:
Timestamp:
2018-09-07T16:34:11Z (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:
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/generic/src/adt/cht.c

    r508b0df1 rfc10e1b  
    537537        h->new_b = NULL;
    538538        h->op = op;
    539         atomic_set(&h->item_cnt, 0);
    540         atomic_set(&h->resize_reqs, 0);
     539        atomic_store(&h->item_cnt, 0);
     540        atomic_store(&h->resize_reqs, 0);
    541541
    542542        if (NULL == op->remove_callback) {
     
    618618
    619619        /* You must clear the table of items. Otherwise cht_destroy will leak. */
    620         assert(atomic_get(&h->item_cnt) == 0);
     620        assert(atomic_load(&h->item_cnt) == 0);
    621621}
    622622
     
    625625{
    626626        /* Wait for resize to complete. */
    627         while (0 < atomic_get(&h->resize_reqs)) {
     627        while (0 < atomic_load(&h->resize_reqs)) {
    628628                rcu_barrier();
    629629        }
     
    21222122
    21232123        if ((need_shrink || missed_shrink) && h->b->order > h->min_order) {
    2124                 atomic_count_t resize_reqs = atomic_preinc(&h->resize_reqs);
     2124                size_t resize_reqs = atomic_preinc(&h->resize_reqs);
    21252125                /* The first resize request. Start the resizer. */
    21262126                if (1 == resize_reqs) {
     
    21432143
    21442144        if ((need_grow || missed_grow) && h->b->order < CHT_MAX_ORDER) {
    2145                 atomic_count_t resize_reqs = atomic_preinc(&h->resize_reqs);
     2145                size_t resize_reqs = atomic_preinc(&h->resize_reqs);
    21462146                /* The first resize request. Start the resizer. */
    21472147                if (1 == resize_reqs) {
     
    21602160        /* Make resize_reqs visible. */
    21612161        read_barrier();
    2162         assert(0 < atomic_get(&h->resize_reqs));
     2162        assert(0 < atomic_load(&h->resize_reqs));
    21632163#endif
    21642164
     
    21682168                /* Load the most recent h->item_cnt. */
    21692169                read_barrier();
    2170                 size_t cur_items = (size_t) atomic_get(&h->item_cnt);
     2170                size_t cur_items = (size_t) atomic_load(&h->item_cnt);
    21712171                size_t bucket_cnt = (1 << h->b->order);
    21722172                size_t max_items = h->max_load * bucket_cnt;
     
    21782178                } else {
    21792179                        /* Table is just the right size. */
    2180                         atomic_count_t reqs = atomic_predec(&h->resize_reqs);
     2180                        size_t reqs = atomic_predec(&h->resize_reqs);
    21812181                        done = (reqs == 0);
    21822182                }
Note: See TracChangeset for help on using the changeset viewer.