diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-11-05 13:44:14 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-11-05 13:44:14 +0000 |
| commit | fc2cb8fb39c510bf6d91a7dcef415840a843cd9c (patch) | |
| tree | 953c21f29aa9a57c1c25071251f5f3fc3c9478b9 /core/sync | |
| parent | c937d38db2b31b885256b9aac0d606032f6c5343 (diff) | |
Remove `#no_copy`
Diffstat (limited to 'core/sync')
| -rw-r--r-- | core/sync/extended.odin | 18 | ||||
| -rw-r--r-- | core/sync/primitives.odin | 10 | ||||
| -rw-r--r-- | core/sync/primitives_atomic.odin | 10 |
3 files changed, 19 insertions, 19 deletions
diff --git a/core/sync/extended.odin b/core/sync/extended.odin index 82fc3d751..8566eccc8 100644 --- a/core/sync/extended.odin +++ b/core/sync/extended.odin @@ -26,7 +26,7 @@ is not allowed to become negative. **Note**: Just like any synchronization primitives, a wait group cannot be copied after first use. See documentation for `Mutex` or `Cond`. */ -Wait_Group :: struct #no_copy { +Wait_Group :: struct { counter: int, mutex: Mutex, cond: Cond, @@ -144,7 +144,7 @@ thread procedure. thread.destroy(t) } */ -Barrier :: struct #no_copy { +Barrier :: struct { mutex: Mutex, cond: Cond, index: int, @@ -206,7 +206,7 @@ When a thread calls `auto_reset_event_wait`, its execution will be blocked, until the event is signalled by another thread. The call to `auto_reset_event_signal` wakes up exactly one thread waiting for the event. */ -Auto_Reset_Event :: struct #no_copy { +Auto_Reset_Event :: struct { // status == 0: Event is reset and no threads are waiting // status == 1: Event is signalled // status == -N: Event is reset and N threads are waiting @@ -260,7 +260,7 @@ of entries into the critical section. This type of synchronization primitive is applicable for short critical sections in low-contention systems, as it uses a spinlock under the hood. */ -Ticket_Mutex :: struct #no_copy { +Ticket_Mutex :: struct { ticket: uint, serving: uint, } @@ -332,7 +332,7 @@ Once a lock on a benaphore is acquired by a thread, no other thread is allowed into any critical sections, associted with the same benaphore, until the lock is released. */ -Benaphore :: struct #no_copy { +Benaphore :: struct { counter: i32, sema: Sema, } @@ -424,7 +424,7 @@ to acquire another lock on the same benaphore. When a thread has acquired the lock on a benaphore, the benaphore will stay locked until the thread releases the lock as many times as it has been locked by the thread. */ -Recursive_Benaphore :: struct #no_copy { +Recursive_Benaphore :: struct { counter: int, owner: int, recursion: i32, @@ -536,7 +536,7 @@ Once action. `Once` a synchronization primitive, that only allows a single entry into a critical section from a single thread. */ -Once :: struct #no_copy { +Once :: struct { m: Mutex, done: bool, } @@ -636,7 +636,7 @@ A Parker is an associated token which is initially not present: * The `unpark` procedure automatically makes the token available if it was not already. */ -Parker :: struct #no_copy { +Parker :: struct { state: Futex, } @@ -713,7 +713,7 @@ A one-shot event is an associated token which is initially not present: * The `one_shot_event_signal` procedure automatically makes the token available if its was not already. */ -One_Shot_Event :: struct #no_copy { +One_Shot_Event :: struct { state: Futex, } diff --git a/core/sync/primitives.odin b/core/sync/primitives.odin index f091de045..276427477 100644 --- a/core/sync/primitives.odin +++ b/core/sync/primitives.odin @@ -36,7 +36,7 @@ holding another lock, that will cause a trivial case of deadlock. Do not use `Mutex` in recursive functions. In case multiple locks by the same thread are desired, use `Recursive_Mutex`. */ -Mutex :: struct #no_copy { +Mutex :: struct { impl: _Mutex, } @@ -147,7 +147,7 @@ result in broken and unsafe behavior. For this reason, mutexes are marked as exclusive lock more than once from the same thread, or an exclusive and shared lock on the same thread. Taking a shared lock multiple times is acceptable. */ -RW_Mutex :: struct #no_copy { +RW_Mutex :: struct { impl: _RW_Mutex, } @@ -313,7 +313,7 @@ released. Trying to use a copy of the lock at a different memory address will result in broken and unsafe behavior. For this reason, mutexes are marked as `#no_copy`. */ -Recursive_Mutex :: struct #no_copy { +Recursive_Mutex :: struct { impl: _Recursive_Mutex, } @@ -414,7 +414,7 @@ lock has been released. Trying to use a copy of the lock at a different memory address will result in broken and unsafe behavior. For this reason, condition variables are marked as `#no_copy`. */ -Cond :: struct #no_copy { +Cond :: struct { impl: _Cond, } @@ -494,7 +494,7 @@ must watch the same memory address to know when the lock has been released. Trying to use a copy of the lock at a different memory address will result in broken and unsafe behavior. For this reason, semaphores are marked as `#no_copy`. */ -Sema :: struct #no_copy { +Sema :: struct { impl: _Sema, } diff --git a/core/sync/primitives_atomic.odin b/core/sync/primitives_atomic.odin index c694e5f96..9d5bdf7ee 100644 --- a/core/sync/primitives_atomic.odin +++ b/core/sync/primitives_atomic.odin @@ -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 #no_copy { +Atomic_Mutex :: struct { state: Atomic_Mutex_State, } @@ -105,7 +105,7 @@ Atomic_RW_Mutex_State_Reader_Mask :: ~Atomic_RW_Mutex_State_Is_Writing // 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 #no_copy { +Atomic_RW_Mutex :: struct { state: Atomic_RW_Mutex_State, mutex: Atomic_Mutex, sema: Atomic_Sema, @@ -246,7 +246,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 #no_copy { +Atomic_Recursive_Mutex :: struct { owner: int, recursion: int, mutex: Mutex, @@ -309,7 +309,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 #no_copy { +Atomic_Cond :: struct { state: Futex, } @@ -344,7 +344,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 #no_copy { +Atomic_Sema :: struct { count: Futex, } |