mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Get rid of req for 64 bit atomics
This commit is contained in:
		| @@ -509,22 +509,6 @@ JanetAtomicInt janet_atomic_dec(JanetAtomicInt volatile *x) { | |||||||
| #endif | #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 */ | /* Some definitions for function-like macros */ | ||||||
|  |  | ||||||
| JANET_API JanetStructHead *(janet_struct_head)(JanetStruct st) { | JANET_API JanetStructHead *(janet_struct_head)(JanetStruct st) { | ||||||
|   | |||||||
| @@ -633,11 +633,11 @@ void janet_addtimeout(double sec) { | |||||||
| } | } | ||||||
|  |  | ||||||
| void janet_ev_inc_refcount(void) { | 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) { | void janet_ev_dec_refcount(void) { | ||||||
|     janet_atomic64_dec(&janet_vm.listener_count); |     janet_atomic_dec(&janet_vm.listener_count); | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Channels */ | /* Channels */ | ||||||
|   | |||||||
| @@ -156,7 +156,7 @@ struct JanetVM { | |||||||
|     JanetQueue spawn; |     JanetQueue spawn; | ||||||
|     JanetTimeout *tq; |     JanetTimeout *tq; | ||||||
|     JanetRNG ev_rng; |     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 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 */ |     JanetTable active_tasks; /* All possibly live task fibers - used just for tracking */ | ||||||
|     JanetArray *listeners; /* For GC */ |     JanetArray *listeners; /* For GC */ | ||||||
|   | |||||||
| @@ -637,15 +637,11 @@ struct JanetListenerState { | |||||||
|  * signals. Define them here */ |  * signals. Define them here */ | ||||||
| #ifdef JANET_WINDOWS | #ifdef JANET_WINDOWS | ||||||
| typedef long JanetAtomicInt; | typedef long JanetAtomicInt; | ||||||
| typedef long long JanetAtomicInt64; |  | ||||||
| #else | #else | ||||||
| typedef int32_t JanetAtomicInt; | typedef int32_t JanetAtomicInt; | ||||||
| typedef int64_t JanetAtomicInt64; |  | ||||||
| #endif | #endif | ||||||
| JANET_API JanetAtomicInt janet_atomic_inc(JanetAtomicInt volatile *x); | JANET_API JanetAtomicInt janet_atomic_inc(JanetAtomicInt volatile *x); | ||||||
| JANET_API JanetAtomicInt janet_atomic_dec(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 | /* 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 |  * nanboxing approach, for 32 or 64 bits, and the standard C version. Code in the rest of the | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose