mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add sdl3_atomic.odin
This commit is contained in:
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
@(export)
|
||||||
|
foreign import lib {
|
||||||
|
"SDL3.lib"
|
||||||
|
}
|
||||||
Vendored
+1
-1
@@ -29,7 +29,7 @@ AsyncIOOutcome :: struct {
|
|||||||
|
|
||||||
AsyncIOQueue :: struct {}
|
AsyncIOQueue :: struct {}
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="SDL_")
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
foreign lib {
|
foreign lib {
|
||||||
AsyncIOFromFile :: proc(file: cstring, mode: cstring) -> ^AsyncIO ---
|
AsyncIOFromFile :: proc(file: cstring, mode: cstring) -> ^AsyncIO ---
|
||||||
GetAsyncIOSize :: proc(asyncio: ^AsyncIO) -> Sint64 ---
|
GetAsyncIOSize :: proc(asyncio: ^AsyncIO) -> Sint64 ---
|
||||||
|
|||||||
Vendored
+42
@@ -0,0 +1,42 @@
|
|||||||
|
package sdl3
|
||||||
|
|
||||||
|
import "base:intrinsics"
|
||||||
|
import "core:c"
|
||||||
|
|
||||||
|
SpinLock :: distinct c.int
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_")
|
||||||
|
foreign lib {
|
||||||
|
@(require_results)
|
||||||
|
TryLockSpinlock :: proc(lock: ^SpinLock) -> bool ---
|
||||||
|
LockSpinlock :: proc(lock: ^SpinLock) ---
|
||||||
|
UnlockSpinlock :: proc(lock: ^SpinLock) ---
|
||||||
|
|
||||||
|
|
||||||
|
MemoryBarrierReleaseFunction :: proc() ---
|
||||||
|
MemoryBarrierAcquireFunction :: proc() ---
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryBarrierRelease :: MemoryBarrierReleaseFunction
|
||||||
|
MemoryBarrierAcquire :: MemoryBarrierAcquireFunction
|
||||||
|
|
||||||
|
CPUPauseInstruction :: intrinsics.cpu_relax
|
||||||
|
|
||||||
|
|
||||||
|
AtomicInt :: distinct c.int
|
||||||
|
AtomicU32 :: distinct Uint32
|
||||||
|
|
||||||
|
@(default_calling_convention="c", link_prefix="SDL_", require_results)
|
||||||
|
foreign lib {
|
||||||
|
CompareAndSwapAtomicInt :: proc(a: ^AtomicInt, oldval, newval: c.int) -> bool ---
|
||||||
|
SetAtomicInt :: proc(a: ^AtomicInt, v: c.int) -> int ---
|
||||||
|
GetAtomicInt :: proc(a: ^AtomicInt) -> int ---
|
||||||
|
AddAtomicInt :: proc(a: ^AtomicInt, v: c.int) -> int ---
|
||||||
|
|
||||||
|
CompareAndSwapAtomicU32 :: proc(a: ^AtomicU32, oldval, newval: Uint32) -> bool ---
|
||||||
|
SetAtomicU32 :: proc(a: ^AtomicU32, v: Uint32) -> Uint32 ---
|
||||||
|
GetAtomicU32 :: proc(a: ^AtomicU32) -> Uint32 ---
|
||||||
|
CompareAndSwapAtomicPointer :: proc(a: ^rawptr, oldval, newval: rawptr) -> bool ---
|
||||||
|
SetAtomicPointer :: proc(a: ^rawptr, v: rawptr) -> rawptr ---
|
||||||
|
GetAtomicPointer :: proc(a: ^rawptr) -> rawptr ---
|
||||||
|
}
|
||||||
Vendored
-5
@@ -7,11 +7,6 @@ import "core:c"
|
|||||||
#assert(size_of(c.int) == size_of(b32))
|
#assert(size_of(c.int) == size_of(b32))
|
||||||
#assert(size_of(c.int) == size_of(rune))
|
#assert(size_of(c.int) == size_of(rune))
|
||||||
|
|
||||||
foreign import lib_ {
|
|
||||||
"SDL3.lib"
|
|
||||||
}
|
|
||||||
lib :: lib_
|
|
||||||
|
|
||||||
|
|
||||||
SIZE_MAX :: 1<<(8*size_of(uint)) - 1
|
SIZE_MAX :: 1<<(8*size_of(uint)) - 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user