#include "threaddef.h"
#include <stdlib.h>
Functions | |
void VMCALL | hythread_shutdown (void) |
Shut down the threading library associated with the current thread. | |
void VMCALL | hythread_init (hythread_library_t lib) |
Initialize a threading library. | |
hythread_t VMCALL | hythread_self (void) |
Return the hythread_t for the current thread. | |
IDATA VMCALL | hythread_create (hythread_t *handle, UDATA stacksize, UDATA priority, UDATA suspend, hythread_entrypoint_t entrypoint, void *entryarg) |
Create a new OS thread. | |
IDATA VMCALL | hythread_attach (hythread_t *handle) |
Attach an OS thread to the threading library. | |
void VMCALL | hythread_suspend (void) |
Suspend the current thread. | |
void VMCALL | hythread_resume (hythread_t thread) |
Resume a thread. | |
void VMCALL | hythread_yield (void) |
Yield the processor. | |
IDATA VMCALL | hythread_monitor_destroy (hythread_monitor_t monitor) |
Destroy a monitor. | |
IDATA VMCALL | hythread_monitor_enter (hythread_monitor_t monitor) |
Enter a monitor. | |
IDATA VMCALL | hythread_monitor_exit (hythread_monitor_t monitor) |
Exit a monitor. | |
IDATA VMCALL | hythread_monitor_wait (hythread_monitor_t monitor) |
Wait on a monitor until notified. | |
IDATA VMCALL | hythread_monitor_notify (hythread_monitor_t monitor) |
Notify a single thread waiting on a monitor. | |
IDATA VMCALL | hythread_monitor_notify_all (hythread_monitor_t monitor) |
Notify all threads waiting on a monitor. | |
IDATA VMCALL | hythread_tls_alloc (hythread_tls_key_t *handle) |
Allocate a thread local storage (TLS) key. | |
IDATA VMCALL | hythread_tls_free (hythread_tls_key_t key) |
Release a TLS key. | |
IDATA VMCALL | hythread_tls_set (hythread_t thread, hythread_tls_key_t key, void *value) |
Set a thread's TLS value. | |
IDATA VMCALL | hythread_set_priority (hythread_t thread, UDATA priority) |
Set a thread's execution priority. | |
void VMCALL | hythread_interrupt (hythread_t thread) |
Interrupt a thread. | |
UDATA VMCALL | hythread_interrupted (hythread_t thread) |
Return the value of a thread's interrupted flag. | |
UDATA VMCALL | hythread_clear_interrupted (void) |
Clear the interrupted flag of the current thread and return its previous value. | |
IDATA VMCALL | hythread_sleep_interruptable (I_64 millis, IDATA nanos) |
Suspend the current thread from executing for at least the specified time. | |
IDATA VMCALL | hythread_sleep (I_64 millis) |
Suspend the current thread from executing for at least the specified time. | |
void VMCALL | hythread_cancel (hythread_t thread) |
Terminate a running thread. | |
void VMCALL | hythread_detach (hythread_t thread) |
Detach a thread from the threading library. | |
void VMCALL NORETURN | hythread_exit (hythread_monitor_t monitor) |
Exit the current thread. | |
void VMCALL | hythread_priority_interrupt (hythread_t thread) |
Priority interrupt a thread. | |
UDATA VMCALL | hythread_priority_interrupted (hythread_t thread) |
Return the value of a thread's priority interrupted flag. | |
UDATA VMCALL | hythread_clear_priority_interrupted (void) |
Clear the priority interrupted flag of the current thread and return its previous value. | |
IDATA VMCALL | hythread_monitor_try_enter (hythread_monitor_t monitor) |
Attempt to enter a monitor without blocking. | |
IDATA VMCALL | hythread_monitor_wait_timed (hythread_monitor_t monitor, I_64 millis, IDATA nanos) |
Wait on a monitor until notified or timed out. | |
UDATA *VMCALL | hythread_global (char *name) |
Fetch or create a 'named global'. | |
IDATA VMCALL | hythread_monitor_wait_interruptable (hythread_monitor_t monitor, I_64 millis, IDATA nanos) |
Wait on a monitor until notified, interrupted (priority or normal), or timed out. | |
UDATA VMCALL | hythread_monitor_num_waiting (hythread_monitor_t monitor) |
Returns how many threads are currently waiting on a monitor. | |
IDATA VMCALL | hythread_monitor_exit_using_threadId (hythread_monitor_t monitor, hythread_t threadId) |
Exit a monitor. | |
IDATA VMCALL | hythread_monitor_enter_using_threadId (hythread_monitor_t monitor, hythread_t threadId) |
Enter a monitor. | |
IDATA VMCALL | hythread_monitor_try_enter_using_threadId (hythread_monitor_t monitor, hythread_t threadId) |
Attempt to enter a monitor without blocking. | |
UDATA VMCALL | hythread_lib_get_flags () |
Get threading library global flags. | |
UDATA VMCALL | hythread_lib_set_flags (UDATA flags) |
Set threading library global flags. | |
UDATA VMCALL | hythread_lib_clear_flags (UDATA flags) |
Clear specified threading library global flags. | |
IDATA VMCALL | hythread_monitor_init_with_name (hythread_monitor_t *handle, UDATA flags, char *name) |
Acquire and initialize a new monitor from the threading library. | |
void VMCALL | hythread_lib_lock (hythread_t self) |
Acquire the threading library's global lock. | |
void VMCALL | hythread_lib_unlock (hythread_t self) |
Release the threading library's global lock. | |
IDATA VMCALL | hythread_park (I_64 millis, IDATA nanos) |
'Park' the current thread. | |
void VMCALL | hythread_unpark (hythread_t thread) |
'Unpark' the specified thread. | |
IDATA VMCALL | hythread_tls_alloc_with_finalizer (hythread_tls_key_t *handle, hythread_tls_finalizer_t finalizer) |
Allocate a thread local storage (TLS) key. | |
UDATA VMCALL | hythread_current_stack_free (void) |
Return the remaining useable bytes of the current thread's OS stack. |
|
Attach an OS thread to the threading library. Create a new hythread_t to represent the existing OS thread. Attaching a thread is required when a thread was created outside of the threading library wants to use any of the threading library functionality. If the OS thread is already attached, handle is set to point to the existing hythread_t.
|
|
Terminate a running thread.
|
|
Clear the interrupted flag of the current thread and return its previous value.
|
|
Clear the priority interrupted flag of the current thread and return its previous value.
|
|
Create a new OS thread.
The created thread is attached to the threading library.
|
|
Return the remaining useable bytes of the current thread's OS stack.
|
|
Detach a thread from the threading library.
If the thread is already dead, this call will destroy it.
|
|
Exit the current thread. If the thread has been detached, it is destroyed. If monitor is not NULL, the monitor will be exited before the thread terminates. This is useful if the thread wishes to signal its termination to a watcher, since it exits the monitor and terminates the thread without ever returning control to the thread's routine, which might be running in a DLL which is about to be closed.
|
|
Fetch or create a 'named global'.
Return a pointer to the data associated with a named global with the specified name.
|
|
Initialize a threading library.
|
|
Interrupt a thread. If the thread is currently blocked (i.e. waiting on a monitor_wait or sleeping) resume the thread and cause it to return from the blocking function with HYTHREAD_INTERRUPTED.
|
|
Return the value of a thread's interrupted flag.
|
|
Clear specified threading library global flags.
|
|
Get threading library global flags. Returns the flags for the threading library associated with the current thread.
|
|
Acquire the threading library's global lock.
|
|
Set threading library global flags. Sets the flags for the threading library associated with the current thread.
|
|
Release the threading library's global lock.
|
|
Destroy a monitor. Destroying a monitor frees the internal resources associated with it.
|
|
Enter a monitor. A thread may re-enter a monitor it owns multiple times, but must exit the monitor the same number of times before any other thread wanting to enter the monitor is permitted to continue.
|
|
Enter a monitor. This is a slightly faster version of hythread_monitor_enter because the hythread_t for the current thread doesn't have to be looked up
|
|
Exit a monitor. Exit a monitor, and if the owning count is zero, release it.
|
|
Exit a monitor. This is a slightly faster version of hythread_monitor_exit because the hythread_t for the current thread doesn't have to be looked up
|
|
Acquire and initialize a new monitor from the threading library.
|
|
Notify a single thread waiting on a monitor. A thread is considered to be waiting on the monitor if it is currently blocked while executing hythread_monitor_wait on the monitor. If no threads are waiting, no action is taken.
|
|
Notify all threads waiting on a monitor. A thread is considered to be waiting on the monitor if it is currently blocked while executing hythread_monitor_wait on the monitor. If no threads are waiting, no action is taken.
|
|
Returns how many threads are currently waiting on a monitor.
|
|
Attempt to enter a monitor without blocking. If the thread must block before it enters the monitor this function returns immediately with a negative value to indicate failure.
|
|
Attempt to enter a monitor without blocking.
If the thread must block before it enters the monitor this function returns immediately with a negative value to indicate failure. This is a slightly faster version of hythread_monitor_try_enter because the current thread's hythread_t doesn't have to be looked up.
|
|
Wait on a monitor until notified. Release the monitor, wait for a signal (notification), then re-acquire the monitor.
|
|
Wait on a monitor until notified, interrupted (priority or normal), or timed out. A timeout of 0 (0ms, 0ns) indicates wait indefinitely. If 'interruptable' is non-zero, the wait may be interrupted by one of the interrupt functions. (i.e. hythread_interrupt, hythread_priority_interrupt);
|
|
Wait on a monitor until notified or timed out. A timeout of 0 (0ms, 0ns) indicates wait indefinitely.
|
|
'Park' the current thread. Stop the current thread from executing until it is unparked, interrupted, or the specified timeout elapses. Unlike wait or sleep, the interrupted flag is NOT cleared by this API.
|
|
Priority interrupt a thread. If the thread is currently blocked (i.e. waiting on a monitor_wait or sleeping) resume the thread and return from the blocking function with HYTHREAD_PRIORITY_INTERRUPTED
|
|
Return the value of a thread's priority interrupted flag.
|
|
Resume a thread. Take a threads out of the suspended state. If the thread is not suspended, no action is taken.
|
|
Return the hythread_t for the current thread.
|
|
Set a thread's execution priority.
|
|
Shut down the threading library associated with the current thread.
|
|
Suspend the current thread from executing for at least the specified time.
|
|
Suspend the current thread from executing for at least the specified time.
|
|
Suspend the current thread. Stop the current thread from executing until it is resumed.
|
|
Allocate a thread local storage (TLS) key. Create and return a new, unique key for thread local storage.
|
|
Allocate a thread local storage (TLS) key. Create and return a new, unique key for thread local storage.
|
|
Release a TLS key. Release a TLS key previously allocated by hythread_tls_alloc.
|
|
Set a thread's TLS value.
|
|
'Unpark' the specified thread. If the thread is parked, it will return from park. If the thread is not parked, its 'UNPARKED' flag will be set, and it will return immediately the next time it is parked. Note that unparks are not counted. Unparking a thread once is the same as unparking it n times.
|
|
Yield the processor.
|