Ruby
3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
|
Go to the source code of this file.
Functions | |
rb_nativethread_id_t | rb_nativethread_self (void) |
Queries the ID of the native thread that is calling this function. More... | |
void | rb_nativethread_lock_initialize (rb_nativethread_lock_t *lock) |
Fills the passed lock with an initial value. More... | |
void | rb_nativethread_lock_destroy (rb_nativethread_lock_t *lock) |
Destroys the passed mutex. More... | |
void | rb_nativethread_lock_lock (rb_nativethread_lock_t *lock) |
Blocks until the current thread obtains a lock. More... | |
void | rb_nativethread_lock_unlock (rb_nativethread_lock_t *lock) |
Releases a lock. More... | |
void | rb_native_mutex_lock (rb_nativethread_lock_t *lock) |
Just another name of rb_nativethread_lock_lock. More... | |
int | rb_native_mutex_trylock (rb_nativethread_lock_t *lock) |
Identical to rb_native_mutex_lock(), except it doesn't block in case rb_native_mutex_lock() would. More... | |
void | rb_native_mutex_unlock (rb_nativethread_lock_t *lock) |
Just another name of rb_nativethread_lock_unlock. More... | |
void | rb_native_mutex_initialize (rb_nativethread_lock_t *lock) |
Just another name of rb_nativethread_lock_initialize. More... | |
void | rb_native_mutex_destroy (rb_nativethread_lock_t *lock) |
Just another name of rb_nativethread_lock_destroy. More... | |
void | rb_native_cond_signal (rb_nativethread_cond_t *cond) |
Signals a condition variable. More... | |
void | rb_native_cond_broadcast (rb_nativethread_cond_t *cond) |
Signals a condition variable. More... | |
void | rb_native_cond_wait (rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex) |
Waits for the passed condition variable to be signalled. More... | |
void | rb_native_cond_timedwait (rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec) |
Identical to rb_native_cond_wait(), except it additionally takes timeout in msec resolution. More... | |
void | rb_native_cond_initialize (rb_nativethread_cond_t *cond) |
Fills the passed condition variable with an initial value. More... | |
void | rb_native_cond_destroy (rb_nativethread_cond_t *cond) |
Destroys the passed condition variable. More... | |
This file contains wrapper APIs for native thread primitives which Ruby interpreter uses.
Now, we only support pthread and Windows threads.
If you want to use Ruby's Mutex and so on to synchronize Ruby Threads, please use Mutex directly.
Definition in file thread_native.h.
void rb_native_cond_broadcast | ( | rb_nativethread_cond_t * | cond | ) |
Signals a condition variable.
[out] | cond | A condition variable to ping. |
cond
gets signalled. void rb_native_cond_destroy | ( | rb_nativethread_cond_t * | cond | ) |
Destroys the passed condition variable.
[out] | cond | A condition variable to kill. |
cond
is no longer eligible for other functions. void rb_native_cond_initialize | ( | rb_nativethread_cond_t * | cond | ) |
Fills the passed condition variable with an initial value.
[out] | cond | A condition variable to initialise. |
cond
is updated to its initial state. void rb_native_cond_signal | ( | rb_nativethread_cond_t * | cond | ) |
Signals a condition variable.
[out] | cond | A condition variable to ping. |
cond
gets signalled. pthread_cond_signal(3posix)
says it can even be "impossible to avoid the unblocking of more than one thread blocked on a condition variable". Just brace spurious wakeups. void rb_native_cond_timedwait | ( | rb_nativethread_cond_t * | cond, |
rb_nativethread_lock_t * | mutex, | ||
unsigned long | msec | ||
) |
Identical to rb_native_cond_wait(), except it additionally takes timeout in msec resolution.
Timeouts can be detected by catching exceptions.
[out] | cond | A condition variable to wait. |
[out] | mutex | A mutex. |
[in] | msec | Timeout. |
rb_eSystemCallError | Errno::ETIMEDOUT for timeout. |
mutex
is owned by the current thread. mutex
is owned by the current thread. void rb_native_cond_wait | ( | rb_nativethread_cond_t * | cond, |
rb_nativethread_lock_t * | mutex | ||
) |
Waits for the passed condition variable to be signalled.
[out] | cond | A condition variable to wait. |
[out] | mutex | A mutex. |
mutex
is owned by the current thread. mutex
is owned by the current thread. void rb_native_mutex_destroy | ( | rb_nativethread_lock_t * | lock | ) |
Just another name of rb_nativethread_lock_destroy.
Referenced by rb_nativethread_lock_destroy().
void rb_native_mutex_initialize | ( | rb_nativethread_lock_t * | lock | ) |
Just another name of rb_nativethread_lock_initialize.
Referenced by rb_nativethread_lock_initialize().
void rb_native_mutex_lock | ( | rb_nativethread_lock_t * | lock | ) |
Just another name of rb_nativethread_lock_lock.
Referenced by rb_nativethread_lock_lock().
int rb_native_mutex_trylock | ( | rb_nativethread_lock_t * | lock | ) |
Identical to rb_native_mutex_lock(), except it doesn't block in case rb_native_mutex_lock() would.
[out] | lock | A mutex to lock. |
0 | lock is successfully owned by the current thread. |
EBUSY | lock is owned by someone else. |
void rb_native_mutex_unlock | ( | rb_nativethread_lock_t * | lock | ) |
Just another name of rb_nativethread_lock_unlock.
Referenced by rb_nativethread_lock_unlock().
void rb_nativethread_lock_destroy | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_initialize | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_lock | ( | rb_nativethread_lock_t * | lock | ) |
void rb_nativethread_lock_unlock | ( | rb_nativethread_lock_t * | lock | ) |
rb_nativethread_id_t rb_nativethread_self | ( | void | ) |
Queries the ID of the native thread that is calling this function.