mirror of
https://github.com/janet-lang/janet
synced 2024-11-10 10:49:54 +00:00
Get rid of req for 64 bit atomics
This commit is contained in:
parent
7cdd7cf6eb
commit
af7ed4322e
@ -509,22 +509,6 @@ JanetAtomicInt janet_atomic_dec(JanetAtomicInt volatile *x) {
|
||||
#endif
|
||||
}
|
||||
|
||||
JanetAtomicInt64 janet_atomic64_inc(JanetAtomicInt64 volatile *x) {
|
||||
#ifdef JANET_WINDOWS
|
||||
return InterlockedDecrement(x);
|
||||
#else
|
||||
return __atomic_add_fetch(x, 1, __ATOMIC_RELAXED);
|
||||
#endif
|
||||
}
|
||||
|
||||
JanetAtomicInt64 janet_atomic64_dec(JanetAtomicInt64 volatile *x) {
|
||||
#ifdef JANET_WINDOWS
|
||||
return InterlockedDecrement64(x);
|
||||
#else
|
||||
return __atomic_add_fetch(x, -1, __ATOMIC_RELAXED);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Some definitions for function-like macros */
|
||||
|
||||
JANET_API JanetStructHead *(janet_struct_head)(JanetStruct st) {
|
||||
|
@ -633,11 +633,11 @@ void janet_addtimeout(double sec) {
|
||||
}
|
||||
|
||||
void janet_ev_inc_refcount(void) {
|
||||
janet_atomic64_inc(&janet_vm.listener_count);
|
||||
janet_atomic_inc(&janet_vm.listener_count);
|
||||
}
|
||||
|
||||
void janet_ev_dec_refcount(void) {
|
||||
janet_atomic64_dec(&janet_vm.listener_count);
|
||||
janet_atomic_dec(&janet_vm.listener_count);
|
||||
}
|
||||
|
||||
/* Channels */
|
||||
|
@ -156,7 +156,7 @@ struct JanetVM {
|
||||
JanetQueue spawn;
|
||||
JanetTimeout *tq;
|
||||
JanetRNG ev_rng;
|
||||
volatile JanetAtomicInt64 listener_count; /* used in signal handler, must be volatile */
|
||||
volatile JanetAtomicInt listener_count; /* used in signal handler, must be volatile */
|
||||
JanetTable threaded_abstracts; /* All abstract types that can be shared between threads (used in this thread) */
|
||||
JanetTable active_tasks; /* All possibly live task fibers - used just for tracking */
|
||||
JanetArray *listeners; /* For GC */
|
||||
|
@ -637,15 +637,11 @@ struct JanetListenerState {
|
||||
* signals. Define them here */
|
||||
#ifdef JANET_WINDOWS
|
||||
typedef long JanetAtomicInt;
|
||||
typedef long long JanetAtomicInt64;
|
||||
#else
|
||||
typedef int32_t JanetAtomicInt;
|
||||
typedef int64_t JanetAtomicInt64;
|
||||
#endif
|
||||
JANET_API JanetAtomicInt janet_atomic_inc(JanetAtomicInt volatile *x);
|
||||
JANET_API JanetAtomicInt janet_atomic_dec(JanetAtomicInt volatile *x);
|
||||
JANET_API JanetAtomicInt64 janet_atomic64_inc(JanetAtomicInt64 volatile *x);
|
||||
JANET_API JanetAtomicInt64 janet_atomic64_dec(JanetAtomicInt64 volatile *x);
|
||||
|
||||
/* We provide three possible implementations of Janets. The preferred
|
||||
* nanboxing approach, for 32 or 64 bits, and the standard C version. Code in the rest of the
|
||||
|
Loading…
Reference in New Issue
Block a user