Add #no_copy to sync primitives

This commit is contained in:
gingerBill
2023-04-15 15:41:30 +01:00
parent 5da76ae34b
commit e79883e4fd
3 changed files with 18 additions and 18 deletions
+5 -5
View File
@@ -13,7 +13,7 @@ Atomic_Mutex_State :: enum Futex {
// The zero value for a Atomic_Mutex is an unlocked mutex
//
// An Atomic_Mutex must not be copied after first use
Atomic_Mutex :: struct {
Atomic_Mutex :: struct #no_copy {
state: Atomic_Mutex_State,
}
@@ -109,7 +109,7 @@ Atomic_RW_Mutex_State_Reader_Mask :: Atomic_RW_Mutex_State(1<<(Atomic_RW_Mutex_S
// The zero value for an Atomic_RW_Mutex is an unlocked mutex
//
// An Atomic_RW_Mutex must not be copied after first use
Atomic_RW_Mutex :: struct {
Atomic_RW_Mutex :: struct #no_copy {
state: Atomic_RW_Mutex_State,
mutex: Atomic_Mutex,
sema: Atomic_Sema,
@@ -222,7 +222,7 @@ atomic_rw_mutex_shared_guard :: proc "contextless" (m: ^Atomic_RW_Mutex) -> bool
// The zero value for a Recursive_Mutex is an unlocked mutex
//
// An Atomic_Recursive_Mutex must not be copied after first use
Atomic_Recursive_Mutex :: struct {
Atomic_Recursive_Mutex :: struct #no_copy {
owner: int,
recursion: int,
mutex: Mutex,
@@ -285,7 +285,7 @@ atomic_recursive_mutex_guard :: proc "contextless" (m: ^Atomic_Recursive_Mutex)
// waiting for signalling the occurence of an event
//
// An Atomic_Cond must not be copied after first use
Atomic_Cond :: struct {
Atomic_Cond :: struct #no_copy {
state: Futex,
}
@@ -320,7 +320,7 @@ atomic_cond_broadcast :: proc "contextless" (c: ^Atomic_Cond) {
// Posting to the semaphore increases the count by one, or the provided amount.
//
// An Atomic_Sema must not be copied after first use
Atomic_Sema :: struct {
Atomic_Sema :: struct #no_copy {
count: Futex,
}