Module
Module documentation.
modulesync
@briefConcurrency primitives
@detailsProvides wrappers for Mutex/CondVar/atomic Int64/WaitGroup/Once.
@see
- index.html
Classes
Classes and inheritance.
classsync::Int64
@briefInt64
@noteMemory-ordering semantics of add/load/store/compare_and_swap depend on the runtime implementation.
class Int64 {
/*
@brief Underlying handleclasssync::Mutex
@briefMutex
@detailsMutex wrapper (provided by the runtime)
class Mutex {
/*
@brief Underlying handleclasssync::CondVar
@briefCondVar
@detailsCondition variable wrapper. Wait methods must be called while holding the associated Mutex.
class CondVar {
/*
@brief Underlying handleclasssync::WaitGroup
@briefWaitGroup
class WaitGroup {
/*
@brief Counterclasssync::Once
@briefOnce
@noteNon-first do calls return 0 immediately.
class Once {
/*
@brief State flagFunctions
Free functions and class methods.
functionsync::__mutex_new
Signature
extern func __mutex_new() -> Int;extern func __mutex_new() -> Int;
/*
@brief Binds the low-level runtime symbol `__mutex_free`.@briefBinds the low-level runtime symbol `__mutex_new`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionsync::__mutex_free
Signature
extern func __mutex_free(h: Int) -> Void;extern func __mutex_free(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__mutex_lock`.@briefBinds the low-level runtime symbol `__mutex_free`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__mutex_lock
Signature
extern func __mutex_lock(h: Int) -> Void;extern func __mutex_lock(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__mutex_unlock`.@briefBinds the low-level runtime symbol `__mutex_lock`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__mutex_unlock
Signature
extern func __mutex_unlock(h: Int) -> Void;extern func __mutex_unlock(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__condvar_new`.@briefBinds the low-level runtime symbol `__mutex_unlock`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__condvar_new
Signature
extern func __condvar_new() -> Int;extern func __condvar_new() -> Int;
/*
@brief Binds the low-level runtime symbol `__condvar_free`.@briefBinds the low-level runtime symbol `__condvar_new`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functionsync::__condvar_free
Signature
extern func __condvar_free(h: Int) -> Void;extern func __condvar_free(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__condvar_wait`.@briefBinds the low-level runtime symbol `__condvar_free`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__condvar_wait
Signature
extern func __condvar_wait(cv_h: Int, mutex_h: Int) -> Void;extern func __condvar_wait(cv_h: Int, mutex_h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__condvar_wait_timeout_ms`.@briefBinds the low-level runtime symbol `__condvar_wait`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- cv_hNative handle used to identify the cv handle resource.
- mutex_hNative handle used to identify the mutex handle resource.
@returnVoid
functionsync::__condvar_wait_timeout_ms
Signature
extern func __condvar_wait_timeout_ms(cv_h: Int, mutex_h: Int, timeout_ms: Int) -> Int;extern func __condvar_wait_timeout_ms(cv_h: Int, mutex_h: Int, timeout_ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__condvar_signal`.@briefBinds the low-level runtime symbol `__condvar_wait_timeout_ms`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- cv_hNative handle used to identify the cv handle resource.
- mutex_hNative handle used to identify the mutex handle resource.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns the operation result as `Int`.
functionsync::__condvar_signal
Signature
extern func __condvar_signal(h: Int) -> Void;extern func __condvar_signal(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__condvar_broadcast`.@briefBinds the low-level runtime symbol `__condvar_signal`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__condvar_broadcast
Signature
extern func __condvar_broadcast(h: Int) -> Void;extern func __condvar_broadcast(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_new`.@briefBinds the low-level runtime symbol `__condvar_broadcast`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__atomic_i64_new
Signature
extern func __atomic_i64_new(init: Int) -> Int;extern func __atomic_i64_new(init: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_free`.@briefBinds the low-level runtime symbol `__atomic_i64_new`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- initInitial value used when constructing or resetting the object.
@returnReturns the operation result as `Int`.
functionsync::__atomic_i64_free
Signature
extern func __atomic_i64_free(h: Int) -> Void;extern func __atomic_i64_free(h: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_add`.@briefBinds the low-level runtime symbol `__atomic_i64_free`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::__atomic_i64_add
Signature
extern func __atomic_i64_add(h: Int, delta: Int) -> Int;extern func __atomic_i64_add(h: Int, delta: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_load`.@briefBinds the low-level runtime symbol `__atomic_i64_add`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- deltaSigned amount added to or subtracted from the current numeric value.
@returnReturns the operation result as `Int`.
functionsync::__atomic_i64_load
Signature
extern func __atomic_i64_load(h: Int) -> Int;extern func __atomic_i64_load(h: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_store`.@briefBinds the low-level runtime symbol `__atomic_i64_load`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionsync::__atomic_i64_store
Signature
extern func __atomic_i64_store(h: Int, val: Int) -> Void;extern func __atomic_i64_store(h: Int, val: Int) -> Void;
/*
@brief Binds the low-level runtime symbol `__atomic_i64_cas`.@briefBinds the low-level runtime symbol `__atomic_i64_store`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- valValue supplied by the caller for storage, comparison, encoding, or transmission.
@returnVoid
functionsync::__atomic_i64_cas
Signature
extern func __atomic_i64_cas(h: Int, expected: Int, desired: Int) -> Int;extern func __atomic_i64_cas(h: Int, expected: Int, desired: Int) -> Int;
/*@briefBinds the low-level runtime symbol `__atomic_i64_cas`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- hUnderlying runtime handle.
- expectedExpected value used for validation, comparison, or conditional update.
- desiredDesired target value requested by the caller.
@returnReturns the operation result as `Int`.
functionsync::atomic_i64_new
Signature
func atomic_i64_new(init: Int) -> Intfunc atomic_i64_new(init: Int) -> Int {
return __atomic_i64_new(init);
}@briefProvides the system library operation `atomic_i64_new`.
@detailsExecutes the `atomic_i64_new` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- initInitial value used when constructing or resetting the object.
@returnReturns the operation result as `Int`.
functionsync::atomic_i64_free
Signature
func atomic_i64_free(h: Int) -> Voidfunc atomic_i64_free(h: Int) -> Void {
_ = __atomic_i64_free(h);
return;@briefProvides the system library operation `atomic_i64_free`.
@detailsExecutes the `atomic_i64_free` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnVoid
functionsync::atomic_i64_load
Signature
func atomic_i64_load(h: Int) -> Intfunc atomic_i64_load(h: Int) -> Int {
return __atomic_i64_load(h);
}@briefProvides the system library operation `atomic_i64_load`.
@detailsExecutes the `atomic_i64_load` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
@returnReturns the operation result as `Int`.
functionsync::atomic_i64_store
Signature
func atomic_i64_store(h: Int, val: Int) -> Voidfunc atomic_i64_store(h: Int, val: Int) -> Void {
_ = __atomic_i64_store(h, val);
return;@briefProvides the system library operation `atomic_i64_store`.
@detailsExecutes the `atomic_i64_store` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- hUnderlying runtime handle.
- valValue supplied by the caller for storage, comparison, encoding, or transmission.
@returnVoid
functionsync::Int64.init
Signature
func init(self: sync.Int64, init: Int) -> Void func init(self: sync.Int64, init: Int) -> Void {
self.h = __atomic_i64_new(init);
}@briefCreate an atomic variable
@param
- selfInt64 instance
- initInitial value
@returnVoid
functionsync::Int64.free
Signature
func free(self: sync.Int64) -> Void func free(self: sync.Int64) -> Void {
if self.h == 0 {
return;@briefFree the atomic variable
@detailsFrees the underlying handle and sets h to 0.
@param
- selfInt64 instance
@returnVoid
functionsync::Int64.dispose
Signature
func dispose(self: sync.Int64) -> Void func dispose(self: sync.Int64) -> Void {
_ = self.free();
}@briefExplicitly releases resources owned by `Int64`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionsync::Int64.deinit
Signature
func deinit(self: sync.Int64) -> Void func deinit(self: sync.Int64) -> Void {
if self.h != 0 {
_ = self.free();@briefDeinitialize the atomic variable
@detailsAutomatically releases the underlying runtime handle when the object is collected.
@param
- selfInt64 instance
@returnVoid
functionsync::Int64.add
Signature
func add(self: sync.Int64, delta: Int) -> Int func add(self: sync.Int64, delta: Int) -> Int {
return __atomic_i64_add(self.h, delta);
}@briefAtomic add
@detailsAdds delta to the atomic value and returns the result (return semantics depend on the runtime, usually the new value).
@param
- selfInt64 instance
- deltaDelta (may be negative)
@returnReturn value (usually the new value)
functionsync::Int64.load
Signature
func load(self: sync.Int64) -> Int func load(self: sync.Int64) -> Int {
return __atomic_i64_load(self.h);
}@briefAtomic load
@param
- selfInt64 instance
@returnCurrent value
functionsync::Int64.store
Signature
func store(self: sync.Int64, v: Int) -> Void func store(self: sync.Int64, v: Int) -> Void {
_ = __atomic_i64_store(self.h, v);
}@briefAtomic store
@param
- selfInt64 instance
- vNew value to store
@returnVoid
functionsync::Int64.compare_and_swap
Signature
func compare_and_swap(self: sync.Int64, expected: Int, desired: Int) -> Bool func compare_and_swap(self: sync.Int64, expected: Int, desired: Int) -> Bool {
return __atomic_i64_cas(self.h, expected, desired) == 1;
}@briefAtomic compare-and-swap (CAS)
@param
- selfInt64 instance
- expectedExpected value
- desiredDesired value
@returnWhether the swap succeeded
functionsync::Mutex.init
Signature
func init(self: sync.Mutex) -> Void func init(self: sync.Mutex) -> Void {
self.h = __mutex_new();
}@briefCreate a mutex
@param
- selfMutex instance
@returnVoid
functionsync::Mutex.free
Signature
func free(self: sync.Mutex) -> Void func free(self: sync.Mutex) -> Void {
if self.h == 0 {
return;@briefFree the mutex
@detailsFrees the underlying handle and sets h to 0.
@param
- selfMutex instance
@returnVoid
functionsync::Mutex.dispose
Signature
func dispose(self: sync.Mutex) -> Void func dispose(self: sync.Mutex) -> Void {
_ = self.free();
}@briefExplicitly releases resources owned by `Mutex`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionsync::Mutex.deinit
Signature
func deinit(self: sync.Mutex) -> Void func deinit(self: sync.Mutex) -> Void {
if self.h != 0 {
_ = self.free();@briefDeinitialize the mutex
@detailsAutomatically releases the underlying runtime mutex handle when the object is collected.
@param
- selfMutex instance
@returnVoid
functionsync::Mutex.lock
Signature
func lock(self: sync.Mutex) -> Void func lock(self: sync.Mutex) -> Void {
_ = __mutex_lock(self.h);
}@briefLock
@param
- selfMutex instance
@returnVoid
functionsync::Mutex.unlock
Signature
func unlock(self: sync.Mutex) -> Void func unlock(self: sync.Mutex) -> Void {
_ = __mutex_unlock(self.h);
}@briefUnlock
@param
- selfMutex instance
@returnVoid
functionsync::CondVar.init
Signature
func init(self: sync.CondVar) -> Void func init(self: sync.CondVar) -> Void {
self.h = __condvar_new();
}@briefCreate a condition variable
@param
- selfCondVar instance
@returnVoid
functionsync::CondVar.free
Signature
func free(self: sync.CondVar) -> Void func free(self: sync.CondVar) -> Void {
if self.h == 0 {
return;@briefFree the condition variable
@detailsFrees the underlying handle and sets h to 0.
@param
- selfCondVar instance
@returnVoid
functionsync::CondVar.dispose
Signature
func dispose(self: sync.CondVar) -> Void func dispose(self: sync.CondVar) -> Void {
_ = self.free();
}@briefExplicitly releases resources owned by `CondVar`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionsync::CondVar.deinit
Signature
func deinit(self: sync.CondVar) -> Void func deinit(self: sync.CondVar) -> Void {
if self.h != 0 {
_ = self.free();@briefDeinitialize the condition variable
@detailsAutomatically releases the underlying runtime condition variable handle when the object is collected.
@param
- selfCondVar instance
@returnVoid
functionsync::CondVar.wait
Signature
func wait(self: sync.CondVar, mu: sync.Mutex) -> Void func wait(self: sync.CondVar, mu: sync.Mutex) -> Void {
_ = __condvar_wait(self.h, mu.h);
}@briefWait until signaled
@detailsAtomically releases mu while waiting and re-acquires it before returning.
@param
- selfCondVar instance
- muMutex held by the caller
@returnVoid
functionsync::CondVar.wait_timeout
Signature
func wait_timeout(self: sync.CondVar, mu: sync.Mutex, timeout_ms: Int) -> Bool func wait_timeout(self: sync.CondVar, mu: sync.Mutex, timeout_ms: Int) -> Bool {
return __condvar_wait_timeout_ms(self.h, mu.h, timeout_ms) == 1;
}@briefWait with timeout
@detailsReturns true if signaled before timeout, false on timeout.
@param
- selfCondVar instance
- muMutex held by the caller
- timeout_msTimeout in milliseconds
@returnWhether the wait was signaled
functionsync::CondVar.signal
Signature
func signal(self: sync.CondVar) -> Void func signal(self: sync.CondVar) -> Void {
_ = __condvar_signal(self.h);
}@briefWake one waiter
@param
- selfCondVar instance
@returnVoid
functionsync::CondVar.broadcast
Signature
func broadcast(self: sync.CondVar) -> Void func broadcast(self: sync.CondVar) -> Void {
_ = __condvar_broadcast(self.h);
}@briefWake all waiters
@param
- selfCondVar instance
@returnVoid
functionsync::WaitGroup.init
Signature
func init(self: sync.WaitGroup) -> Void func init(self: sync.WaitGroup) -> Void {
self.mu = new sync.Mutex();
self.cv = new sync.CondVar();@briefInitialize a WaitGroup
@detailsInitializes the counter to 0.
@param
- selfWaitGroup instance
@returnVoid
functionsync::WaitGroup.add
Signature
func add(self: sync.WaitGroup, delta: Int) -> Void func add(self: sync.WaitGroup, delta: Int) -> Void {
_ = self.mu.lock();
self.c += delta;@briefAdd or subtract the counter
@param
- selfWaitGroup instance
- deltaDelta (typically positive to add tasks, negative to mark tasks done)
@returnVoid
functionsync::WaitGroup.done
Signature
func done(self: sync.WaitGroup) -> Void func done(self: sync.WaitGroup) -> Void {
_ = self.add(-1);
}@briefMark one task as done
@detailsEquivalent to add(-1).
@param
- selfWaitGroup instance
@returnVoid
functionsync::WaitGroup.wait
Signature
func wait(self: sync.WaitGroup) -> Void func wait(self: sync.WaitGroup) -> Void {
_ = self.mu.lock();
loop (; self.c > 0; ) {@briefWait for all tasks to complete
@param
- selfWaitGroup instance
@returnVoid
functionsync::WaitGroup.deinit
Signature
func deinit(self: sync.WaitGroup) -> Void func deinit(self: sync.WaitGroup) -> Void {
_ = self.cv.free();
_ = self.mu.free();@briefDeinitialize the WaitGroup
@detailsReleases the internal condition variable and mutex handles.
@param
- selfWaitGroup instance
@returnVoid
functionsync::WaitGroup.dispose
Signature
func dispose(self: sync.WaitGroup) -> Void func dispose(self: sync.WaitGroup) -> Void {
_ = self.cv.dispose();
_ = self.mu.dispose();@briefExplicitly releases resources owned by `WaitGroup`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionsync::Once.init
Signature
func init(self: sync.Once) -> Void func init(self: sync.Once) -> Void {
self.done = new sync.Int64(0);
}@briefInitialize Once
@detailsSets done to 0.
@param
- selfOnce instance
@returnVoid
functionsync::Once.do
Signature
func do(self: sync.Once, f: (Int) -> Int, arg: Int) -> Int func do(self: sync.Once, f: (Int) -> Int, arg: Int) -> Int {
if self.done.compare_and_swap(0, 1) {
return f(arg);@briefExecute once
@param
- selfOnce instance
- fFunction to execute (signature: (Int)->Int)
- argArgument passed to f
@returnReturn value of f(arg).
functionsync::Once.deinit
Signature
func deinit(self: sync.Once) -> Void func deinit(self: sync.Once) -> Void {
_ = self.done.free();
}@briefDeinitialize Once
@detailsReleases the internal atomic state handle.
@param
- selfOnce instance
@returnVoid
functionsync::Once.dispose
Signature
func dispose(self: sync.Once) -> Void func dispose(self: sync.Once) -> Void {
_ = self.done.dispose();
}@briefExplicitly releases resources owned by `Once`.
@detailsThis method deterministically cleans up file descriptors, network connections, native handles, buffers, or other external resources. Implementations should be idempotent where possible, and repeated calls must not corrupt object state.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
Variables
Class fields (var).
varsync::Int64.h
Type
Int@briefUnderlying handle
@detailsHandle to the runtime atomic object (created by __atomic_i64_new)
var h: Int;
/*varsync::Mutex.h
Type
Int@briefUnderlying handle
@detailsHandle to the runtime mutex
var h: Int;
/*varsync::CondVar.h
Type
Int@briefUnderlying handle
@detailsHandle to the runtime condition variable
var h: Int;
/*varsync::WaitGroup.mu
Type
sync.Mutex@briefCounter
@detailsNumber of unfinished tasks, protected by mu
var mu: sync.Mutex;
/*
@brief `cv` field.varsync::WaitGroup.cv
Type
sync.CondVar@brief`cv` field.
@detailsHolds the `cv` value for each `WaitGroup` instance. The field type is `sync.CondVar`, and constructors and methods keep it synchronized with the object's runtime state.
var cv: sync.CondVar;
/*
@brief `c` field.varsync::WaitGroup.c
Type
Int@brief`c` field.
@detailsHolds the `c` value for each `WaitGroup` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var cv: sync.CondVar;
/*
@brief `c` field.varsync::Once.done
Type
sync.Int64@briefState flag
@detailsdone=0 means not executed, done=1 means executed
var done: sync.Int64;
/*