-
Notifications
You must be signed in to change notification settings - Fork 56
Thread
chrisd1100 edited this page Aug 25, 2022
·
1 revision
Thread creation and synchronization, atomics.
You should have a solid understanding of multithreaded programming before using any of these functions. This module serves as a cross-platform wrapper around POSIX pthreads
and Windows' critical sections, condition variables, and slim reader/writer (SRW) locks.
Name | Brief |
---|---|
MTY_ThreadCreate | Create an MTY_Thread that executes asynchronously. |
MTY_ThreadDestroy | Wait until an MTY_Thread has finished executing then destroy it. |
MTY_ThreadDetach | Asynchronously run a function and forgo the ability to query its result. |
MTY_ThreadGetID | Get a thread's id . |
MTY_MutexCreate | Create an MTY_Mutex for synchronization. |
MTY_MutexDestroy | Destroy an MTY_Mutex . |
MTY_MutexLock | Wait to acquire a lock on the mutex. |
MTY_MutexTryLock | Try to acquire a lock on a mutex but fail if doing so would block. |
MTY_MutexUnlock | Unlock a mutex. |
MTY_CondCreate | Create an MTY_Cond (condition variable) for signaling between threads. |
MTY_CondDestroy | Destroy an MTY_Cond . |
MTY_CondWait | Wait for a condition variable to be signaled with a timeout. |
MTY_CondSignal | Signal a condition variable on a single blocked thread. |
MTY_CondSignalAll | Signal a condition variable on all blocked threads. |
MTY_RWLockCreate | Create an MTY_RWLock that allows concurrent read access. |
MTY_RWLockDestroy | Destroy an MTY_RWLock . |
MTY_RWTryLockReader | Try to acquire a read lock on an MTY_RWLock but fail if doing so would block. |
MTY_RWLockReader | Acquire a read lock on an MTY_RWLock , blocking other writers. |
MTY_RWLockWriter | Acquire a write lock on an MTY_RWLock , block other readers and writers. |
MTY_RWLockUnlock | Unlock an MTY_RWLock . |
MTY_WaitableCreate | Create an MTY_Waitable object. |
MTY_WaitableDestroy | Destroy an MTY_Waitable . |
MTY_WaitableWait | Wait for a waitable object to be signaled with a timeout. |
MTY_WaitableSignal | Signal a waitable object on a single blocked thread. |
MTY_ThreadPoolCreate | Create an MTY_ThreadPool for asynchronously executing tasks. |
MTY_ThreadPoolDestroy | Destroy an MTY_ThreadPool . |
MTY_ThreadPoolDispatch | Dispatch a function to the thread pool. |
MTY_ThreadPoolDetach | Allow a thread to be reused after it has finished executing. |
MTY_ThreadPoolPoll | Poll the asynchronous state of a thread in a pool. |
MTY_Atomic32Set | Set a 32-bit integer atomically. |
MTY_Atomic64Set | Set a 64-bit integer atomically. |
MTY_Atomic32Get | Get a 32-bit integer atomically. |
MTY_Atomic64Get | Get a 64-bit integer atomically. |
MTY_Atomic32Add | Add to a 32-bit integer atomically. |
MTY_Atomic64Add | Add to a 64-bit integer atomically. |
MTY_Atomic32CAS | Compare two 32-bit values and if the same, atomically set to a new value. |
MTY_Atomic64CAS | Compare two 64-bit values and if the same, atomically set to a new value. |
MTY_GlobalLock | Globally lock via an atomic. |
MTY_GlobalUnlock | Globally unlock via an atomic. |
Name | Brief |
---|---|
MTY_Atomic32 | 32-bit integer used for atomic operations. |
MTY_Atomic64 | 64-bit integer used for atomic operations. |
Name | Brief |
---|---|
MTY_Async | Status of an asynchronous task. |
Name | Brief |
---|---|
MTY_AnonFunc | Function that takes a single opaque argument. |
MTY_ThreadFunc | Function that is executed on a thread. |