Changeset 31e15be in mainline


Ignore:
Timestamp:
2021-08-04T15:18:08Z (3 years ago)
Author:
jxsvoboda <5887334+jxsvoboda@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
98a935e
Parents:
de38873
git-author:
Dmitry Selyutin <ghostmansd@…> (2020-12-23 21:59:08)
git-committer:
jxsvoboda <5887334+jxsvoboda@…> (2021-08-04 15:18:08)
Message:

kernel: deprecate atomic_t

Location:
kernel
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/arch/sun4v/cpu.h

    rde38873 r31e15be  
    5454        uint64_t cpuids[MAX_CORE_STRANDS];
    5555        struct cpu *cpus[MAX_CORE_STRANDS];
    56         atomic_t nrdy;
     56        atomic_size_t nrdy;
    5757        SPINLOCK_DECLARE(proposed_nrdy_lock);
    5858} exec_unit_t;
  • kernel/generic/include/atomic.h

    rde38873 r31e15be  
    4040#include <stdatomic.h>
    4141
    42 // TODO: Remove.
    43 // Before <stdatomic.h> was available, there was only one atomic type
    44 // equivalent to atomic_size_t. This means that in some places, atomic_t can
    45 // be replaced with a more appropriate type (e.g. atomic_bool for flags or
    46 // a signed type for potentially signed values).
    47 // So atomic_t should be replaced with the most appropriate type on a case by
    48 // case basis, and after there are no more uses, remove this type.
    49 typedef atomic_size_t atomic_t;
    50 
    5142#define atomic_predec(val) \
    5243        (atomic_fetch_sub((val), 1) - 1)
  • kernel/generic/include/cap/cap.h

    rde38873 r31e15be  
    8080typedef struct kobject {
    8181        kobject_type_t type;
    82         atomic_t refcnt;
     82        atomic_size_t refcnt;
    8383
    8484        /** Mutex protecting caps_list */
  • kernel/generic/include/cpu.h

    rde38873 r31e15be  
    5858        context_t saved_context;
    5959
    60         atomic_t nrdy;
     60        atomic_size_t nrdy;
    6161        runq_t rq[RQ_COUNT];
    6262        volatile size_t needs_relink;
  • kernel/generic/include/halt.h

    rde38873 r31e15be  
    3838#include <atomic.h>
    3939
    40 extern atomic_t haltstate;
     40extern atomic_bool haltstate;
    4141
    4242extern void halt(void) __attribute__((noreturn));
  • kernel/generic/include/ipc/ipc.h

    rde38873 r31e15be  
    7171        struct call *hangup_call;
    7272        ipc_phone_state_t state;
    73         atomic_t active_calls;
     73        atomic_size_t active_calls;
    7474        /** User-defined label */
    7575        sysarg_t label;
     
    9090         * Number of answers the answerbox is expecting to eventually arrive.
    9191         */
    92         atomic_t active_calls;
     92        atomic_size_t active_calls;
    9393
    9494        /** Phones connected to this answerbox. */
  • kernel/generic/include/mm/slab.h

    rde38873 r31e15be  
    9999
    100100        /* Statistics */
    101         atomic_t allocated_slabs;
    102         atomic_t allocated_objs;
    103         atomic_t cached_objs;
     101        atomic_size_t allocated_slabs;
     102        atomic_size_t allocated_objs;
     103        atomic_size_t cached_objs;
    104104        /** How many magazines in magazines list */
    105         atomic_t magazine_counter;
     105        atomic_size_t magazine_counter;
    106106
    107107        /* Slabs */
  • kernel/generic/include/proc/scheduler.h

    rde38873 r31e15be  
    5252} runq_t;
    5353
    54 extern atomic_t nrdy;
     54extern atomic_size_t nrdy;
    5555extern void scheduler_init(void);
    5656
  • kernel/generic/include/proc/task.h

    rde38873 r31e15be  
    8787
    8888        /** Number of references (i.e. threads). */
    89         atomic_t refcount;
     89        atomic_size_t refcount;
    9090        /** Number of threads that haven't exited yet. */
    91         atomic_t lifecount;
     91        atomic_size_t lifecount;
    9292
    9393        /** Task permissions. */
  • kernel/generic/src/lib/halt.c

    rde38873 r31e15be  
    3636 */
    3737
     38#include <stdbool.h>
    3839#include <halt.h>
    3940#include <log.h>
     
    4445
    4546/** Halt flag */
    46 atomic_t haltstate = 0;
     47atomic_bool haltstate = false;
    4748
    4849/** Halt wrapper
     
    5758
    5859        if (!atomic_load(&haltstate)) {
    59                 atomic_store(&haltstate, 1);
     60                atomic_store(&haltstate, true);
    6061                rundebugger = true;
    6162        }
    6263#else
    63         atomic_store(&haltstate, 1);
     64        atomic_store(&haltstate, true);
    6465#endif
    6566
  • kernel/generic/src/proc/scheduler.c

    rde38873 r31e15be  
    6868static void scheduler_separated_stack(void);
    6969
    70 atomic_t nrdy;  /**< Number of ready threads in the system. */
     70atomic_size_t nrdy;  /**< Number of ready threads in the system. */
    7171
    7272/** Carry out actions before new task runs. */
  • kernel/test/atomic/atomic1.c

    rde38873 r31e15be  
    3232const char *test_atomic1(void)
    3333{
    34         atomic_t a;
     34        atomic_int a;
    3535
    3636        atomic_store(&a, 10);
  • kernel/test/mm/falloc2.c

    rde38873 r31e15be  
    4343#define THREADS      8
    4444
    45 static atomic_t thread_cnt;
    46 static atomic_t thread_fail;
     45static atomic_size_t thread_cnt;
     46static atomic_size_t thread_fail;
    4747
    4848static void falloc(void *arg)
  • kernel/test/synch/semaphore1.c

    rde38873 r31e15be  
    4141
    4242static waitq_t can_start;
    43 static atomic_t items_produced;
    44 static atomic_t items_consumed;
     43static atomic_size_t items_produced;
     44static atomic_size_t items_consumed;
    4545
    4646static void producer(void *arg)
  • kernel/test/thread/thread1.c

    rde38873 r31e15be  
    3030#include <test.h>
    3131#include <atomic.h>
     32#include <stdbool.h>
    3233#include <proc/thread.h>
    3334
     
    3637#define THREADS  5
    3738
    38 static atomic_t finish;
    39 static atomic_t threads_finished;
     39static atomic_bool finish;
     40static atomic_size_t threads_finished;
    4041
    4142static void threadtest(void *data)
     
    5556        size_t total = 0;
    5657
    57         atomic_store(&finish, 1);
     58        atomic_store(&finish, true);
    5859        atomic_store(&threads_finished, 0);
    5960
     
    7273        thread_sleep(10);
    7374
    74         atomic_store(&finish, 0);
     75        atomic_store(&finish, false);
    7576        while (atomic_load(&threads_finished) < total) {
    7677                TPRINTF("Threads left: %zu\n", total - atomic_load(&threads_finished));
Note: See TracChangeset for help on using the changeset viewer.