mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-19 06:01:11 +00:00
Remove #no_copy
This commit is contained in:
@@ -219,12 +219,13 @@ Type :: struct {
|
||||
custom_align: String,
|
||||
|
||||
// Used by:
|
||||
// .Array - 1 count: 0=len
|
||||
// .Enumerated_Array - 1 count: 0=len
|
||||
// .SOA_Struct_Fixed - 1 count: 0=len
|
||||
// .Bit_Set - 2 count: 0=lower, 1=upper
|
||||
// .Simd_Vector - 1 count: 0=len
|
||||
// .Matrix - 2 count: 0=row_count, 1=column_count
|
||||
// .Array - 1 count: 0=len
|
||||
// .Enumerated_Array - 1 count: 0=len
|
||||
// .SOA_Struct_Fixed - 1 count: 0=len
|
||||
// .Bit_Set - 2 count: 0=lower, 1=upper
|
||||
// .Simd_Vector - 1 count: 0=len
|
||||
// .Matrix - 2 count: 0=row_count, 1=column_count
|
||||
// .Struct - <=2 count: 0=min_field_align, 1=max_field_align
|
||||
elem_count_len: u32le,
|
||||
elem_counts: [Type_Elems_Cap]i64le,
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user