replace stdatomic.h with zinnia/atomic.h
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <zinnia/alloc.h>
|
||||
#include <zinnia/assert.h>
|
||||
#include <zinnia/atomic.h>
|
||||
#include <zinnia/errno.h>
|
||||
#include <zinnia/irq.h>
|
||||
#include <zinnia/list.h>
|
||||
@@ -12,7 +13,6 @@
|
||||
#include <zinnia/tailq.h>
|
||||
#include <zinnia/vma.h>
|
||||
#include <arch/sched.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static void idle_func(uintptr_t) {
|
||||
@@ -113,7 +113,7 @@ void sched_yield(struct scheduler* sched) {
|
||||
|
||||
void sched_block(struct scheduler* sched) {
|
||||
irq_lock();
|
||||
if (atomic_exchange_explicit(&sched->current->wake_pending, false, memory_order_acq_rel)) {
|
||||
if (atomic_exchange(&sched->current->wake_pending, false, ATOMIC_ACQ_REL)) {
|
||||
irq_unlock();
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ void sched_wake(struct task* task) {
|
||||
if (task->state == TASK_STATE_BLOCKED)
|
||||
sched_add_task(&percpu_get()->sched, task);
|
||||
else
|
||||
atomic_store_explicit(&task->wake_pending, true, memory_order_release);
|
||||
atomic_store(&task->wake_pending, true, ATOMIC_RELEASE);
|
||||
irq_unlock();
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ errno_t task_create(const char* name, struct vma* space, task_fn_t entry, uintpt
|
||||
return ENOMEM;
|
||||
|
||||
static atomic_size_t last_tid = 0;
|
||||
new_task->id = atomic_fetch_add_explicit(&last_tid, 1, memory_order_acquire);
|
||||
new_task->id = atomic_fetch_add(&last_tid, 1, ATOMIC_ACQUIRE);
|
||||
new_task->space = space;
|
||||
strncpy(new_task->name, name, sizeof(new_task->name));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user