mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Fix comments
This commit is contained in:
@@ -8,7 +8,7 @@ _ :: vg
|
|||||||
Wait group.
|
Wait group.
|
||||||
|
|
||||||
Wait group is a synchronization primitive used by the waiting thread to wait,
|
Wait group is a synchronization primitive used by the waiting thread to wait,
|
||||||
until a all working threads finish work.
|
until all working threads finish work.
|
||||||
|
|
||||||
The waiting thread first sets the number of working threads it will expect to
|
The waiting thread first sets the number of working threads it will expect to
|
||||||
wait for using `wait_group_add` call, and start waiting using `wait_group_wait`
|
wait for using `wait_group_add` call, and start waiting using `wait_group_wait`
|
||||||
@@ -35,7 +35,7 @@ Wait_Group :: struct #no_copy {
|
|||||||
/*
|
/*
|
||||||
Increment an internal counter of a wait group.
|
Increment an internal counter of a wait group.
|
||||||
|
|
||||||
This procedure atomicaly increments a number to the specified wait group's
|
This procedure atomically increments a number to the specified wait group's
|
||||||
internal counter by a specified amount. This operation can be done on any
|
internal counter by a specified amount. This operation can be done on any
|
||||||
thread.
|
thread.
|
||||||
*/
|
*/
|
||||||
@@ -121,7 +121,7 @@ When `barrier_wait` procedure is called by any thread, that thread will block
|
|||||||
the execution, until all threads associated with the barrier reach the same
|
the execution, until all threads associated with the barrier reach the same
|
||||||
point of execution and also call `barrier_wait`.
|
point of execution and also call `barrier_wait`.
|
||||||
|
|
||||||
when barrier is initialized, a `thread_count` parameter is passed, signifying
|
When a barrier is initialized, a `thread_count` parameter is passed, signifying
|
||||||
the amount of participant threads of the barrier. The barrier also keeps track
|
the amount of participant threads of the barrier. The barrier also keeps track
|
||||||
of an internal atomic counter. When a thread calls `barrier_wait`, the internal
|
of an internal atomic counter. When a thread calls `barrier_wait`, the internal
|
||||||
counter is incremented. When the internal counter reaches `thread_count`, it is
|
counter is incremented. When the internal counter reaches `thread_count`, it is
|
||||||
@@ -208,7 +208,7 @@ Represents a thread synchronization primitive that, when signalled, releases one
|
|||||||
single waiting thread and then resets automatically to a state where it can be
|
single waiting thread and then resets automatically to a state where it can be
|
||||||
signalled again.
|
signalled again.
|
||||||
|
|
||||||
When a thread calls `auto_reset_event_wait`, it's execution will be blocked,
|
When a thread calls `auto_reset_event_wait`, its execution will be blocked,
|
||||||
until the event is signalled by another thread. The call to
|
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_signal` wakes up exactly one thread waiting for the event.
|
||||||
*/
|
*/
|
||||||
@@ -331,8 +331,8 @@ Benaphore.
|
|||||||
|
|
||||||
A benaphore is a combination of an atomic variable and a semaphore that can
|
A benaphore is a combination of an atomic variable and a semaphore that can
|
||||||
improve locking efficiency in a no-contention system. Acquiring a benaphore
|
improve locking efficiency in a no-contention system. Acquiring a benaphore
|
||||||
lock doesn't call into an internal semaphore, if no other thread in a middle of
|
lock doesn't call into an internal semaphore, if no other thread is in the
|
||||||
a critical section.
|
middle of a critical section.
|
||||||
|
|
||||||
Once a lock on a benaphore is acquired by a thread, no other thread is allowed
|
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
|
into any critical sections, associted with the same benaphore, until the lock
|
||||||
@@ -381,7 +381,7 @@ Release a lock on a benaphore.
|
|||||||
|
|
||||||
This procedure releases a lock on the specified benaphore. If any of the threads
|
This procedure releases a lock on the specified benaphore. If any of the threads
|
||||||
are waiting on the lock, exactly one thread is allowed into a critical section
|
are waiting on the lock, exactly one thread is allowed into a critical section
|
||||||
associated with the same banaphore.
|
associated with the same benaphore.
|
||||||
*/
|
*/
|
||||||
benaphore_unlock :: proc "contextless" (b: ^Benaphore) {
|
benaphore_unlock :: proc "contextless" (b: ^Benaphore) {
|
||||||
if atomic_sub_explicit(&b.counter, 1, .Release) > 1 {
|
if atomic_sub_explicit(&b.counter, 1, .Release) > 1 {
|
||||||
@@ -418,8 +418,8 @@ benaphore_guard :: proc "contextless" (m: ^Benaphore) -> bool {
|
|||||||
/*
|
/*
|
||||||
Recursive benaphore.
|
Recursive benaphore.
|
||||||
|
|
||||||
Recurisve benaphore is just like a plain benaphore, except it allows reentrancy
|
A recursive benaphore is just like a plain benaphore, except it allows
|
||||||
into the critical section.
|
reentrancy into the critical section.
|
||||||
|
|
||||||
When a lock is acquired on a benaphore, all other threads attempting to
|
When a lock is acquired on a benaphore, all other threads attempting to
|
||||||
acquire a lock on the same benaphore will be blocked from any critical sections,
|
acquire a lock on the same benaphore will be blocked from any critical sections,
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ recursive_mutex_guard :: proc "contextless" (m: ^Recursive_Mutex) -> bool {
|
|||||||
A condition variable.
|
A condition variable.
|
||||||
|
|
||||||
`Cond` implements a condition variable, a rendezvous point for threads waiting
|
`Cond` implements a condition variable, a rendezvous point for threads waiting
|
||||||
for signalling the occurence of an event. Condition variables are used on
|
for signalling the occurence of an event. Condition variables are used in
|
||||||
conjuction with mutexes to provide a shared access to one or more shared
|
conjuction with mutexes to provide a shared access to one or more shared
|
||||||
variable.
|
variable.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user