Ultibo API
C/C++ API for Ultibo Core
Loading...
Searching...
No Matches
threads.h File Reference
#include "ultibo/globaltypes.h"
#include "ultibo/globalconst.h"
#include "ultibo/system.h"
#include "ultibo/platform.h"
#include "ultibo/locale.h"

Go to the source code of this file.

Data Structures

struct  _SPIN_ENTRY
struct  _MUTEX_ENTRY
struct  _CRITICAL_SECTION_ENTRY
struct  _SEMAPHORE_ENTRY
struct  _SYNCHRONIZER_ENTRY
struct  _CONDITION_ENTRY
struct  _COMPLETION_ENTRY
struct  _LIST_ENTRY
struct  _LIST_ELEMENT
struct  _QUEUE_ENTRY
struct  _QUEUE_ELEMENT
struct  _MESSAGE_LIST
struct  _THREAD_MESSAGE
struct  _THREAD_ENTRY
struct  _THREAD_SNAPSHOT
struct  _MESSAGESLOT_ENTRY
struct  _MAILSLOT_ENTRY
struct  _BUFFER_ENTRY
struct  _BUFFER_ITEM
struct  _EVENT_ENTRY
struct  _TIMER_LIST
struct  _TIMER_ITEM
struct  _TIMER_ENTRY
struct  _WORKER_REQUEST
struct  _TASKER_LIST
struct  _TASKER_TASK
struct  _TASKER_THREAD_SEND_MESSAGE
struct  _TASKER_MESSAGESLOT_SEND
struct  _TASKER_SEMAPHORE_SIGNAL
struct  _TASKER_SEMAPHORE_RESET
struct  _TASKER_SEMAPHORE_COMPLETE

Macros

#define LOCK_FLAG_NONE   0x00000000
#define LOCK_FLAG_IRQ   0x00000001
#define LOCK_FLAG_FIQ   0x00000002
#define LOCK_FLAG_IRQFIQ   0x00000004
#define SPIN_SIGNATURE   0x0FEC3B82
#define SPIN_STATE_UNLOCKED   0
#define SPIN_STATE_LOCKED   1
#define MUTEX_SIGNATURE   0x1C5D7FA4
#define MUTEX_STATE_UNLOCKED   0
#define MUTEX_STATE_LOCKED   1
#define MUTEX_FLAG_NONE   0x00000000
#define MUTEX_FLAG_RECURSIVE   0x00000001
 Mutex can be locked multiple times by the same thread if set (Must be unlocked the same number of times).
#define MUTEX_FLAG_ERRORCHECK   0x00000002
 Mutex will perform a deadlock check if set, will return with an error if already owned by the same thread (and not recursive).
#define CRITICAL_SECTION_SIGNATURE   0x25F3AE01
#define CRITICAL_SECTION_STATE_UNLOCKED   0
#define CRITICAL_SECTION_STATE_LOCKED   1
#define SEMAPHORE_SIGNATURE   0x390A1EB4
#define SEMAPHORE_FLAG_NONE   LOCK_FLAG_NONE
#define SEMAPHORE_FLAG_IRQ   LOCK_FLAG_IRQ
#define SEMAPHORE_FLAG_FIQ   LOCK_FLAG_FIQ
#define SEMAPHORE_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ
#define SYNCHRONIZER_SIGNATURE   0xC5D081FB
#define SYNCHRONIZER_STATE_UNLOCKED   0
#define SYNCHRONIZER_STATE_READER_LOCKED   1
#define SYNCHRONIZER_STATE_WRITER_LOCKED   2
#define SYNCHRONIZER_FLAG_NONE   0x00000000
#define SYNCHRONIZER_FLAG_READ_PRIORITY   0x00000001
 Synchronizer prioritises readers over writers.
#define SYNCHRONIZER_FLAG_WRITE_PRIORITY   0x00000002
 Synchronizer prioritises writers over readers.
#define CONDITION_SIGNATURE   0xD14D3C0A
#define CONDITION_FLAG_NONE   0x00000000
#define CONDITION_LOCK_FLAG_NONE   0x00000000
#define CONDITION_LOCK_FLAG_WRITER   0x00000001
 Condition should release and acquire the writer lock on a Synchronizer when ConditionWaitSynchronizer is called (otherwise release and acquire the reader lock).
#define COMPLETION_SIGNATURE   0xFCE24CA1
#define COMPLETION_STATE_RESET   0
#define COMPLETION_STATE_COMPLETE   1
#define COMPLETION_FLAG_NONE   LOCK_FLAG_NONE
#define COMPLETION_FLAG_IRQ   LOCK_FLAG_IRQ
 Disable IRQ during completion operations (Wait/Reset/Complete).
#define COMPLETION_FLAG_FIQ   LOCK_FLAG_FIQ
 Disable FIQ during completion operations (Wait/Reset/Complete).
#define COMPLETION_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ
 Disable IRQ and FIQ during completion operations (Wait/Reset/Complete).
#define COMPLETION_FLAG_COUNTED   0x00000008
 Use a counted value instead of a single state (Affects behaviour of Wait and Complete).
#define LIST_SIGNATURE   0x4A98BE2A
#define LIST_TYPE_NOT_SPECIFIED   0
 A generic thread list without a specific purpose.
#define LIST_TYPE_WAIT_SECTION   1
 A Critical Section Wait List.
#define LIST_TYPE_WAIT_SEMAPHORE   2
 A Semaphore Wait List.
#define LIST_TYPE_WAIT_SYNCHRONIZER   3
 A Synchronizer Wait List.
#define LIST_TYPE_WAIT_CONDITION   4
 A Condition Wait List.
#define LIST_TYPE_WAIT_COMPLETION   5
 A Condition Wait List.
#define LIST_TYPE_WAIT_EVENT   6
 An Event Wait List.
#define LIST_TYPE_WAIT_THREAD   7
 A Thread Wait List.
#define LIST_TYPE_WAIT_MESSAGESLOT   8
 A Messageslot Wait List.
#define LIST_TYPE_WAIT_OTHER   9
 Another type of Wait List (Suitable for passing to ThreadWait/ThreadWaitEx/ThreadWaitMultiple/ThreadRelease).
#define LIST_FLAG_NONE   LOCK_FLAG_NONE
#define LIST_FLAG_IRQ   LOCK_FLAG_IRQ
#define LIST_FLAG_FIQ   LOCK_FLAG_FIQ
#define LIST_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ
#define QUEUE_SIGNATURE   0x57A3BF9E
#define QUEUE_TYPE_NOT_SPECIFIED   0
 A generic thread queue without a specific purpose.
#define QUEUE_TYPE_SCHEDULE_SLEEP   1
 A Scheduler Sleep Queue.
#define QUEUE_TYPE_SCHEDULE_TIMEOUT   2
 A Scheduler Timeout Queue.
#define QUEUE_TYPE_SCHEDULE_TERMINATION   3
 A Scheduler Termination Queue (Threads are placed on termination queue when they exit or are terminated).
#define QUEUE_TYPE_SCHEDULE_NONE   4
 A Scheduler No Priority Queue (Only used for IRQ/FIQ threads which are never selected for scheduling).
#define QUEUE_TYPE_SCHEDULE_IDLE   5
 A Scheduler Idle Priority Queue.
#define QUEUE_TYPE_SCHEDULE_LOWEST   6
 A Scheduler Lowest Priority Queue.
#define QUEUE_TYPE_SCHEDULE_LOWER   7
 A Scheduler Lower Priority Queue.
#define QUEUE_TYPE_SCHEDULE_NORMAL   8
 A Scheduler Normal Priority Queue.
#define QUEUE_TYPE_SCHEDULE_HIGHER   9
 A Scheduler Higher Priority Queue.
#define QUEUE_TYPE_SCHEDULE_HIGHEST   10
 A Scheduler Highest Priority Queue.
#define QUEUE_TYPE_SCHEDULE_CRITICAL   11
 A Scheduler Critical Priority Queue.
#define QUEUE_FLAG_NONE   LOCK_FLAG_NONE
#define QUEUE_FLAG_IRQ   LOCK_FLAG_IRQ
#define QUEUE_FLAG_FIQ   LOCK_FLAG_FIQ
#define QUEUE_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ
#define QUEUE_FLAG_DESCENDING   0x00000008
#define QUEUE_FLAG_DELTA   0x00000010
#define QUEUE_KEY_NONE   (int32_t)0x7FFFFFFF
 Null key value returned from an empty Queue.
#define QUEUE_KEY_MAX   (int32_t)0x7FFFFFFE
 Max key that can be ordered in a Queue.
#define QUEUE_KEY_MIN   (int32_t)0x80000000
 Min key that can be ordered in a Queue.
#define THREAD_SIGNATURE   0x6C2BA10F
#define THREAD_TYPE_NORMAL   0
 A Normal thread (No special case handling).
#define THREAD_TYPE_IDLE   1
 An Idle thread (Used to calculate ultilization and provide an always ready thread).
#define THREAD_TYPE_IRQ   2
 An IRQ thread (Used by the IRQ handler during interrupt time).
#define THREAD_TYPE_FIQ   3
 An FIQ thread (Used by the FIQ handler during interrupt time).
#define THREAD_TYPE_SWI   4
 A Software Interrupt (SWI) thread (Used by the SWI handler during a system call).
#define THREAD_FLAG_NONE   0x00000000
#define THREAD_FLAG_PERSIST   0x00000001
 If set thread handle will persist until explicitly destroyed (Otherwise destroyed after termination quantum has elapsed).
#define THREAD_FLAG_CANCELLED   0x00000002
 Indicates that thread has been cancelled, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).
#define THREAD_FLAG_CANCEL_DISABLE   0x00000004
 Indicates that thread cancellation is disabled for a thread, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).
#define THREAD_FLAG_CANCEL_ASYNCHRONOUS   0x00000008
 Indicates that asynchronous thread cancellation is enabled for a thread, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).
#define THREAD_FLAG_INTERNAL   THREAD_FLAG_NONE + 0x80000000
 Note: Temporary value to avoid warning.
#define THREAD_STATE_RUNNING   1
 Thread is currently running.
#define THREAD_STATE_READY   2
 Thread is on ready queue.
#define THREAD_STATE_SLEEP   3
 Thread is sleeping.
#define THREAD_STATE_SUSPENDED   4
 Thread is suspended.
#define THREAD_STATE_WAIT   5
 Thread is on a wait list.
#define THREAD_STATE_WAIT_TIMEOUT   6
 Thread is on a wait list with timeout.
#define THREAD_STATE_RECEIVE   7
 Thread is waiting to receive a message.
#define THREAD_STATE_RECEIVE_TIMEOUT   8
 Thread is waiting to receive a message with timeout.
#define THREAD_STATE_HALTED   9
 Thread has been halted (Due to an unhandled exception etc).
#define THREAD_STATE_TERMINATED   10
#define THREAD_PRIORITY_NONE   0
 To Do THREAD_STATE_SEND / THREAD_STATE_SEND_TIMEOUT ? //Who would wake them up ? //Timeout is ok, but what about send only ?
#define THREAD_PRIORITY_IDLE   1
#define THREAD_PRIORITY_LOWEST   2
#define THREAD_PRIORITY_LOWER   3
#define THREAD_PRIORITY_NORMAL   4
#define THREAD_PRIORITY_HIGHER   5
#define THREAD_PRIORITY_HIGHEST   6
#define THREAD_PRIORITY_CRITICAL   7
#define THREAD_PRIORITY_DEFAULT   THREAD_PRIORITY_NORMAL
 Default thread priority.
#define THREAD_PRIORITY_MINIMUM   THREAD_PRIORITY_IDLE
 Minimum thread priority.
#define THREAD_PRIORITY_MAXIMUM   THREAD_PRIORITY_CRITICAL
 Maximum thread priority.
#define THREAD_PRIORITY_COUNT   THREAD_PRIORITY_MAXIMUM + 1
 Number of thread priority levels.
#define THREAD_PRIORITY_BELOW_NORMAL   THREAD_PRIORITY_LOWER
#define THREAD_PRIORITY_ABOVE_NORMAL   THREAD_PRIORITY_HIGHER
#define THREAD_PRIORITY_TIME_CRITICAL   THREAD_PRIORITY_CRITICAL
#define THREAD_NAME_LENGTH   SIZE_64
 Length of thread name.
#define IRQ_THREAD_NAME   "IRQ"
#define FIQ_THREAD_NAME   "FIQ"
#define SWI_THREAD_NAME   "SWI"
#define IDLE_THREAD_NAME   "Idle"
#define MAIN_THREAD_NAME   "Main"
#define TIMER_THREAD_NAME   "Timer"
#define WORKER_THREAD_NAME   "Worker"
#define TIMER_PRIORITY_THREAD_NAME   "Priority Timer"
#define WORKER_PRIORITY_THREAD_NAME   "Priority Worker"
#define RTL_THREAD_NAME   "RTL Thread"
#define TIMER_THREAD_PRIORITY   THREAD_PRIORITY_NORMAL
#define WORKER_THREAD_PRIORITY   THREAD_PRIORITY_NORMAL
#define TIMER_PRIORITY_THREAD_PRIORITY   THREAD_PRIORITY_HIGHEST
#define WORKER_PRIORITY_THREAD_PRIORITY   THREAD_PRIORITY_HIGHER
#define THREAD_CREATE_NONE   0x00000000
#define THREAD_CREATE_SUSPENDED   0x00000004
#define THREAD_TLS_FREE   0x00000000
#define THREAD_TLS_USED   0x00000001
#define THREAD_TLS_INVALID   0xFFFFFFFF
#define THREAD_TLS_MAXIMUM   SIZE_64
 The maximum number TLS index slots available.
#define THREAD_TLS_FLAG_NONE   0x00000000
#define THREAD_TLS_FLAG_FREE   0x00000001
 If set then pointer in thread TLS index will be freed on ThreadReleaseTlsIndex or ThreadDestroy.
#define THREAD_LISTS_MAXIMUM   SIZE_64
 Maximum number of lists a thread can wait on at the same time.
#define MESSAGESLOT_SIGNATURE   0xB631CE4B
#define MESSAGESLOT_FLAG_NONE   LOCK_FLAG_NONE
#define MESSAGESLOT_FLAG_IRQ   LOCK_FLAG_IRQ
#define MESSAGESLOT_FLAG_FIQ   LOCK_FLAG_FIQ
#define MESSAGESLOT_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ
#define MAILSLOT_SIGNATURE   0x7A409BF3
#define BUFFER_SIGNATURE   0x830BEA71
#define BUFFER_FLAG_NONE   0x00000000
#define BUFFER_FLAG_SHARED   0x00000001
 If set the buffer memory (Not the buffer entry itself) is allocated from shared memory.
#define EVENT_SIGNATURE   0x903BA69D
#define EVENT_STATE_UNSIGNALED   0
#define EVENT_STATE_SIGNALED   1
#define EVENT_FLAG_NONE   0x00000000
#define EVENT_FLAG_INITIAL_STATE   0x00000001
#define EVENT_FLAG_MANUAL_RESET   0x00000002
#define TIMER_SIGNATURE   0xAB7E07FB
#define TIMER_STATE_DISABLED   0
#define TIMER_STATE_ENABLED   1
#define TIMER_FLAG_NONE   0x00000000
#define TIMER_FLAG_RESCHEDULE   0x00000001
 Timer should be rescheduled each time the event completes.
#define TIMER_FLAG_IMMEDIATE   0x00000002
 Timer event should be executed immediately and then each interval milliseconds.
#define TIMER_FLAG_WORKER   0x00000004
 Timer event should be executed by a worker thread instead of a timer thread.
#define TIMER_FLAG_PRIORITY   0x00000008
 Timer event should be executed by a priority timer thread.
#define TIMER_KEY_NONE   (int32_t)0x7FFFFFFF
 Null key value returned from an empty Timer list.
#define TIMER_KEY_MAX   (int32_t)0x7FFFFFFE
 Max key that can be ordered in a Timer list.
#define TIMER_KEY_MIN   (int32_t)0x80000000
 Min key that can be ordered in a Timer list.
#define WORKER_SIGNATURE   0xEF6A901B
#define WORKER_FLAG_NONE   0x00000000
#define WORKER_FLAG_RESCHEDULE   0x00000001
 Worker task should be rescheduled each time the task completes.
#define WORKER_FLAG_IMMEDIATE   0x00000002
 Worker task should be executed immediately and then each interval milliseconds.
#define WORKER_FLAG_CANCEL   0x00000004
 Internal flag to indicate the worker task should be cancelled next time the interval expires.
#define WORKER_FLAG_NOFREE   0x00000008
 Internal flag to tell worker execute not to free the worker request when it is completed.
#define WORKER_FLAG_TERMINATE   0x00000010
 Internal flag to tell worker execute to terminate the worker thread.
#define WORKER_FLAG_IRQ   0x00000020
 Internal flag to tell worker execute to free IRQ memory when the request is completed.
#define WORKER_FLAG_FIQ   0x00000040
 Internal flag to tell worker execute to free FIQ memory when the request is completed.
#define WORKER_FLAG_PRIORITY   0x00000080
 Worker task should be executed by a priority worker thread.
#define WORKER_FLAG_INTERNAL   WORKER_FLAG_CANCEL | WORKER_FLAG_NOFREE | WORKER_FLAG_TERMINATE | WORKER_FLAG_IRQ | WORKER_FLAG_FIQ
 Internal only flags.
#define WORKER_FLAG_EXCLUDED_IRQ   WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE
 Excluded flags.
#define WORKER_FLAG_EXCLUDED_FIQ   WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE
 Excluded flags.
#define TASKER_TASK_THREADSENDMESSAGE   1
 Perform a ThreadSendMessage() function using the tasker list.
#define TASKER_TASK_MESSAGESLOTSEND   2
 Perform a MessageslotSend() function using the tasker list.
#define TASKER_TASK_SEMAPHORESIGNAL   3
 Perform a SemaphoreSignal() function using the tasker list.
#define TASKER_TASK_COMPLETIONRESET   4
 Perform a CompletionReset() function using the tasker list.
#define TASKER_TASK_COMPLETIONCOMPLETE   5
 Perform a CompletionComplete() or CompletionCompleteAll() function using the tasker list.
#define SCHEDULER_MIGRATION_DISABLED   0
#define SCHEDULER_MIGRATION_ENABLED   1
#define SCHEDULER_PREEMPT_DISABLED   0
#define SCHEDULER_PREEMPT_ENABLED   1
#define SCHEDULER_ALLOCATION_DISABLED   0
#define SCHEDULER_ALLOCATION_ENABLED   1
#define SCHEDULER_MASK_NONE   (1 << THREAD_PRIORITY_NONE)
#define SCHEDULER_MASK_IDLE   (1 << THREAD_PRIORITY_IDLE)
#define SCHEDULER_MASK_LOWEST   (1 << THREAD_PRIORITY_LOWEST)
#define SCHEDULER_MASK_LOWER   (1 << THREAD_PRIORITY_LOWER)
#define SCHEDULER_MASK_NORMAL   (1 << THREAD_PRIORITY_NORMAL)
#define SCHEDULER_MASK_HIGHER   (1 << THREAD_PRIORITY_HIGHER)
#define SCHEDULER_MASK_HIGHEST   (1 << THREAD_PRIORITY_HIGHEST)
#define SCHEDULER_MASK_CRITICAL   (1 << THREAD_PRIORITY_CRITICAL)
#define SCHEDULER_QUANTUM_NONE   0
#define SCHEDULER_QUANTUM_IDLE   0
#define SCHEDULER_QUANTUM_LOWEST   1
#define SCHEDULER_QUANTUM_LOWER   2
#define SCHEDULER_QUANTUM_NORMAL   4
#define SCHEDULER_QUANTUM_HIGHER   6
#define SCHEDULER_QUANTUM_HIGHEST   8
#define SCHEDULER_QUANTUM_CRITICAL   10

Typedefs

typedef struct _SPIN_ENTRY SPIN_ENTRY
typedef struct _MUTEX_ENTRY MUTEX_ENTRY
typedef struct _CRITICAL_SECTION_ENTRY CRITICAL_SECTION_ENTRY
typedef struct _SEMAPHORE_ENTRY SEMAPHORE_ENTRY
typedef struct _SYNCHRONIZER_ENTRY SYNCHRONIZER_ENTRY
typedef struct _CONDITION_ENTRY CONDITION_ENTRY
typedef struct _COMPLETION_ENTRY COMPLETION_ENTRY
typedef struct _LIST_ELEMENT LIST_ELEMENT
typedef struct _LIST_ENTRY LIST_ENTRY
typedef LIST_HANDLE LIST_HANDLES[THREAD_LISTS_MAXIMUM]
typedef struct _QUEUE_ELEMENT QUEUE_ELEMENT
typedef struct _QUEUE_ENTRY QUEUE_ENTRY
typedef struct _THREAD_MESSAGE THREAD_MESSAGE
typedef struct _MESSAGE_LIST MESSAGE_LIST
typedef struct _THREAD_ENTRY THREAD_ENTRY
typedef struct _THREAD_SNAPSHOT THREAD_SNAPSHOT
typedef struct _MESSAGESLOT_ENTRY MESSAGESLOT_ENTRY
typedef struct _MAILSLOT_ENTRY MAILSLOT_ENTRY
typedef struct _BUFFER_ITEM BUFFER_ITEM
typedef struct _BUFFER_ENTRY BUFFER_ENTRY
typedef struct _EVENT_ENTRY EVENT_ENTRY
typedef struct _TIMER_ITEM TIMER_ITEM
typedef struct _TIMER_LIST TIMER_LIST
typedef struct _TIMER_ENTRY TIMER_ENTRY
typedef struct _WORKER_REQUEST WORKER_REQUEST
typedef struct _TASKER_TASK TASKER_TASK
typedef struct _TASKER_LIST TASKER_LIST
typedef struct _TASKER_THREAD_SEND_MESSAGE TASKER_THREAD_SEND_MESSAGE
typedef struct _TASKER_MESSAGESLOT_SEND TASKER_MESSAGESLOT_SEND
typedef struct _TASKER_SEMAPHORE_SIGNAL TASKER_SEMAPHORE_SIGNAL
typedef struct _TASKER_SEMAPHORE_RESET TASKER_SEMAPHORE_RESET
typedef struct _TASKER_SEMAPHORE_COMPLETE TASKER_SEMAPHORE_COMPLETE
typedef ssize_t STDCALL(* thread_start_proc) (void *parameter)
typedef void STDCALL(* thread_end_proc) (uint32_t exitcode)

Functions

SPIN_HANDLE STDCALL spin_create (void)
 Create and insert a new Spin entry.
SPIN_HANDLE STDCALL spin_create_ex (BOOL initialowner)
 Create and insert a new Spin entry.
uint32_t STDCALL spin_destroy (SPIN_HANDLE spin)
 Destroy and remove an existing Spin entry.
THREAD_HANDLE STDCALL spin_owner (SPIN_HANDLE spin)
 Get the current owner of an existing Spin entry.
uint32_t STDCALL spin_lock (SPIN_HANDLE spin)
 Lock an existing Spin entry.
uint32_t STDCALL spin_unlock (SPIN_HANDLE spin)
 Unlock an existing Spin entry.
uint32_t STDCALL spin_lock_irq (SPIN_HANDLE spin)
 Lock an existing Spin entry, disable IRQ and save the previous IRQ state.
uint32_t STDCALL spin_unlock_irq (SPIN_HANDLE spin)
 Unlock an existing Spin entry and restore the previous IRQ state.
uint32_t STDCALL spin_lock_fiq (SPIN_HANDLE spin)
 Lock an existing Spin entry, disable FIQ and save the previous FIQ state.
uint32_t STDCALL spin_unlock_fiq (SPIN_HANDLE spin)
 Unlock an existing Spin entry and restore the previous FIQ state.
uint32_t STDCALL spin_lock_irq_fiq (SPIN_HANDLE spin)
 Lock an existing Spin entry, disable IRQ and FIQ and save the previous IRQ and FIQ state.
uint32_t STDCALL spin_unlock_irq_fiq (SPIN_HANDLE spin)
 Unlock an existing Spin entry and restore the previous IRQ and FIQ state.
uint32_t STDCALL spin_lock_preempt (SPIN_HANDLE spin)
 Lock an existing Spin entry, disable IRQ or IRQ/FIQ and save the previous IRQ or IRQ/FIQ state.
uint32_t STDCALL spin_unlock_preempt (SPIN_HANDLE spin)
 Unlock an existing Spin entry and restore the previous IRQ or IRQ/FIQ state.
BOOL STDCALL spin_check_irq (SPIN_HANDLE spin)
 Check the mask that stores the previous IRQ state to determine if IRQ is enabled.
BOOL STDCALL spin_check_fiq (SPIN_HANDLE spin)
 Check the mask that stores the previous FIQ state to determine if FIQ is enabled.
uint32_t STDCALL spin_exchange_irq (SPIN_HANDLE spin1, SPIN_HANDLE spin2)
 Exchange the previous IRQ state between two Spin entries.
uint32_t STDCALL spin_exchange_fiq (SPIN_HANDLE spin1, SPIN_HANDLE spin2)
 Exchange the previous FIQ state between two Spin entries.
MUTEX_HANDLE STDCALL mutex_create (void)
 Create and insert a new Mutex entry.
MUTEX_HANDLE STDCALL mutex_create_ex (BOOL initialowner, uint32_t spincount, uint32_t flags)
 Create and insert a new Mutex entry.
uint32_t STDCALL mutex_destroy (MUTEX_HANDLE mutex)
 Destroy and remove an existing Mutex entry.
uint32_t STDCALL mutex_flags (MUTEX_HANDLE mutex)
 Get the current flags of an existing Mutex entry.
uint32_t STDCALL mutex_count (MUTEX_HANDLE mutex)
 Get the current lock count of an existing Mutex entry.
THREAD_HANDLE STDCALL mutex_owner (MUTEX_HANDLE mutex)
 Get the current owner of an existing Mutex entry.
uint32_t STDCALL mutex_lock (MUTEX_HANDLE mutex)
 Lock an existing Mutex entry.
uint32_t STDCALL mutex_unlock (MUTEX_HANDLE mutex)
 Unlock an existing Mutex entry.
uint32_t STDCALL mutex_try_lock (MUTEX_HANDLE mutex)
 Try to lock an existing Mutex entry.
CRITICAL_SECTION_HANDLE STDCALL critical_section_create (void)
 Create and insert a new CriticalSection entry.
CRITICAL_SECTION_HANDLE STDCALL critical_section_create_ex (BOOL initialowner, uint32_t spincount)
 Create and insert a new CriticalSection entry.
uint32_t STDCALL critical_section_destroy (CRITICAL_SECTION_HANDLE criticalsection)
 Destroy and remove an existing CriticalSection entry.
uint32_t STDCALL critical_section_count (CRITICAL_SECTION_HANDLE criticalsection)
 Get the current lock count of an existing CriticalSection entry.
THREAD_HANDLE STDCALL critical_section_owner (CRITICAL_SECTION_HANDLE criticalsection)
 Get the current owner of an existing CriticalSection entry.
uint32_t STDCALL critical_section_set_spin_count (CRITICAL_SECTION_HANDLE criticalsection, uint32_t spincount)
 Set the spin count of an existing CriticalSection entry.
uint32_t STDCALL critical_section_lock (CRITICAL_SECTION_HANDLE criticalsection)
 Lock an existing CriticalSection entry.
uint32_t STDCALL critical_section_lock_ex (CRITICAL_SECTION_HANDLE criticalsection, uint32_t timeout)
 Lock an existing CriticalSection entry.
uint32_t STDCALL critical_section_unlock (CRITICAL_SECTION_HANDLE criticalsection)
 Unlock an existing CriticalSection entry.
uint32_t STDCALL critical_section_try_lock (CRITICAL_SECTION_HANDLE criticalsection)
 Try to lock an existing CriticalSection entry.
SEMAPHORE_HANDLE STDCALL semaphore_create (uint32_t count)
 Create and insert a new Semaphore entry.
SEMAPHORE_HANDLE STDCALL semaphore_create_ex (uint32_t count, uint32_t maximum, uint32_t flags)
 Create and insert a new Semaphore entry.
uint32_t STDCALL semaphore_destroy (SEMAPHORE_HANDLE semaphore)
 Destroy and remove an existing Semaphore entry.
uint32_t STDCALL semaphore_count (SEMAPHORE_HANDLE semaphore)
 Get the current count of an existing Semaphore entry.
uint32_t STDCALL semaphore_wait (SEMAPHORE_HANDLE semaphore)
 Wait on an existing Semaphore entry.
uint32_t STDCALL semaphore_wait_ex (SEMAPHORE_HANDLE semaphore, uint32_t timeout)
 Wait on an existing Semaphore entry.
uint32_t STDCALL semaphore_signal (SEMAPHORE_HANDLE semaphore)
 Signal an existing Semaphore entry.
uint32_t STDCALL semaphore_signal_ex (SEMAPHORE_HANDLE semaphore, uint32_t count, uint32_t *previous)
 Signal an existing Semaphore entry one or more times.
SYNCHRONIZER_HANDLE STDCALL synchronizer_create (void)
 Create and insert a new Synchronizer entry.
SYNCHRONIZER_HANDLE STDCALL synchronizer_create_ex (BOOL initialreader, BOOL initialwriter)
 Create and insert a new Synchronizer entry.
uint32_t STDCALL synchronizer_destroy (SYNCHRONIZER_HANDLE synchronizer)
 Destroy and remove an existing Synchronizer entry.
uint32_t STDCALL synchronizer_reader_count (SYNCHRONIZER_HANDLE synchronizer)
 Get the current reader count of an existing Synchronizer entry.
THREAD_HANDLE STDCALL synchronizer_reader_last (SYNCHRONIZER_HANDLE synchronizer)
 Get the last reader thread of an existing Synchronizer entry.
uint32_t STDCALL synchronizer_reader_lock (SYNCHRONIZER_HANDLE synchronizer)
 Lock an existing Synchronizer entry for reading.
uint32_t STDCALL synchronizer_reader_lock_ex (SYNCHRONIZER_HANDLE synchronizer, uint32_t timeout)
 Lock an existing Synchronizer entry for reading.
uint32_t STDCALL synchronizer_reader_unlock (SYNCHRONIZER_HANDLE synchronizer)
 Unlock an existing Synchronizer entry.
uint32_t STDCALL synchronizer_reader_convert (SYNCHRONIZER_HANDLE synchronizer)
 Convert a reader lock on an existing Synchronizer entry to a writer lock.
uint32_t STDCALL synchronizer_reader_convert_ex (SYNCHRONIZER_HANDLE synchronizer, uint32_t timeout)
 Convert a reader lock on an existing Synchronizer entry to a writer lock.
uint32_t STDCALL synchronizer_writer_count (SYNCHRONIZER_HANDLE synchronizer)
 Get the current writer count of an existing Synchronizer entry.
THREAD_HANDLE STDCALL synchronizer_writer_owner (SYNCHRONIZER_HANDLE synchronizer)
 Get the current writer owner of an existing Synchronizer entry.
uint32_t STDCALL synchronizer_writer_lock (SYNCHRONIZER_HANDLE synchronizer)
 Lock an existing Synchronizer entry for writing.
uint32_t STDCALL synchronizer_writer_lock_ex (SYNCHRONIZER_HANDLE synchronizer, uint32_t timeout)
 Lock an existing Synchronizer entry for writing.
uint32_t STDCALL synchronizer_writer_unlock (SYNCHRONIZER_HANDLE synchronizer)
 Unlock an existing Synchronizer entry.
uint32_t STDCALL synchronizer_writer_convert (SYNCHRONIZER_HANDLE synchronizer)
 Convert a writer lock on an existing Synchronizer entry to a reader lock.
CONDITION_HANDLE STDCALL condition_create (void)
 Create and insert a new Condition entry.
uint32_t STDCALL condition_destroy (CONDITION_HANDLE condition)
 Destroy and remove an existing Condition entry.
uint32_t STDCALL condition_wait (CONDITION_HANDLE condition, uint32_t timeout)
 Wait on an existing Condition.
uint32_t STDCALL condition_wait_mutex (CONDITION_HANDLE condition, MUTEX_HANDLE mutex, uint32_t timeout)
 Release a Mutex and Wait on an existing Condition in an atomic operation.
uint32_t STDCALL condition_wait_synchronizer (CONDITION_HANDLE condition, SYNCHRONIZER_HANDLE synchronizer, uint32_t flags, uint32_t timeout)
 Release a Synchronizer and Wait on an existing Condition in an atomic operation.
uint32_t STDCALL condition_wait_critical_section (CONDITION_HANDLE condition, CRITICAL_SECTION_HANDLE criticalsection, uint32_t timeout)
 Release a Critical Section and Wait on an existing Condition in an atomic operation.
uint32_t STDCALL condition_wake (CONDITION_HANDLE condition)
 Wake one thread waiting on an existing Condition.
uint32_t STDCALL condition_wake_all (CONDITION_HANDLE condition)
 Wake all threads waiting on an existing Condition.
COMPLETION_HANDLE STDCALL completion_create (uint32_t flags)
 Create and insert a new Completion entry.
uint32_t STDCALL completion_destroy (COMPLETION_HANDLE completion)
 Destroy and remove an existing Completion entry.
uint32_t STDCALL completion_state (COMPLETION_HANDLE completion)
 Get the current state of an existing Completion entry.
uint32_t STDCALL completion_wait (COMPLETION_HANDLE completion, uint32_t timeout)
 Wait on an existing Completion.
uint32_t STDCALL completion_try_wait (COMPLETION_HANDLE completion)
 Try an existing Completion to see if it is completed.
uint32_t STDCALL completion_reset (COMPLETION_HANDLE completion)
 Reset (uncomplete) the state of an existing Completion entry.
uint32_t STDCALL completion_complete (COMPLETION_HANDLE completion)
 Set (complete) the state of an existing Completion entry.
uint32_t STDCALL completion_complete_all (COMPLETION_HANDLE completion)
 Set (complete) the state of an existing Completion entry.
LIST_HANDLE STDCALL list_create (void)
 Create and insert a new List entry.
LIST_HANDLE STDCALL list_create_ex (uint32_t listtype, uint32_t flags)
 Create and insert a new List entry.
uint32_t STDCALL list_destroy (LIST_HANDLE list)
 Destroy and remove an existing List entry.
uint32_t STDCALL list_count (LIST_HANDLE list)
 Get the current count from the supplied list.
uint32_t STDCALL list_add_first (LIST_HANDLE list, LIST_ELEMENT *element)
 Add the supplied element as the first item in the List.
uint32_t STDCALL list_add_last (LIST_HANDLE list, LIST_ELEMENT *element)
 Add the supplied element as the last item in the List.
LIST_ELEMENT *STDCALL list_get_thread (LIST_HANDLE list, THREAD_HANDLE thread)
 Find the supplied thread in the List and return its element.
LIST_ELEMENT *STDCALL list_get_first (LIST_HANDLE list)
 Get the first element from the List.
LIST_ELEMENT *STDCALL list_get_first_ex (LIST_HANDLE list, BOOL remove)
 Get the first element from the List.
LIST_ELEMENT *STDCALL list_get_last (LIST_HANDLE list)
 Get the last element from the List.
LIST_ELEMENT *STDCALL list_get_last_ex (LIST_HANDLE list, BOOL remove)
 Get the last element from the List.
uint32_t STDCALL list_insert (LIST_HANDLE list, LIST_ELEMENT *previous, LIST_ELEMENT *element)
 Insert a new element in the List.
uint32_t STDCALL list_remove (LIST_HANDLE list, LIST_ELEMENT *element)
 Remove an element from the List.
BOOL STDCALL list_is_empty (LIST_HANDLE list)
 Check if the supplied List is empty.
BOOL STDCALL list_not_empty (LIST_HANDLE list)
 Check if the supplied List is empty.
uint32_t STDCALL list_lock (LIST_HANDLE list)
 Lock the supplied List.
uint32_t STDCALL list_unlock (LIST_HANDLE list)
 Unlock the supplied List.
QUEUE_HANDLE STDCALL queue_create (void)
 Create and insert a new Queue entry.
QUEUE_HANDLE STDCALL queue_create_ex (uint32_t queuetype, uint32_t flags)
 Create and insert a new Queue entry.
uint32_t STDCALL queue_destroy (QUEUE_HANDLE queue)
 Destroy and remove an existing Queue entry.
uint32_t STDCALL queue_count (QUEUE_HANDLE queue)
 Get the current count from the supplied queue.
uint32_t STDCALL queue_enqueue (QUEUE_HANDLE queue, THREAD_HANDLE thread)
 Add the supplied thread as the last item in the Queue.
THREAD_HANDLE STDCALL queue_dequeue (QUEUE_HANDLE queue)
 Get and remove the first thread from the Queue.
int STDCALL queue_first_key (QUEUE_HANDLE queue)
 Get the first Key value from the Queue.
int STDCALL queue_last_key (QUEUE_HANDLE queue)
 Get the last Key value from the Queue.
uint32_t STDCALL queue_insert_key (QUEUE_HANDLE queue, THREAD_HANDLE thread, int key)
 Insert the supplied thread in the Queue ordered based on Key and the flags of the Queue.
uint32_t STDCALL queue_delete_key (QUEUE_HANDLE queue, THREAD_HANDLE thread)
 Delete the supplied thread from the Queue based on the flags of the Queue.
int STDCALL queue_increment_key (QUEUE_HANDLE queue)
 Increment the first Key value in the Queue.
int STDCALL queue_decrement_key (QUEUE_HANDLE queue)
 Decrement the first Key value in the Queue.
BOOL STDCALL queue_is_empty (QUEUE_HANDLE queue)
 Check if the supplied Queue is empty.
BOOL STDCALL queue_not_empty (QUEUE_HANDLE queue)
 Check if the supplied Queue is not empty.
uint32_t STDCALL queue_lock (QUEUE_HANDLE queue)
 Lock the supplied Queue.
uint32_t STDCALL queue_unlock (QUEUE_HANDLE queue)
 Unlock the supplied Queue.
THREAD_HANDLE STDCALL thread_create (thread_start_proc startproc, uint32_t stacksize, uint32_t priority, const char *name, void *parameter)
 Create and insert a new Thread entry.
THREAD_HANDLE STDCALL thread_create_ex (thread_start_proc startproc, uint32_t stacksize, uint32_t priority, uint32_t affinity, uint32_t cpu, const char *name, void *parameter)
 Create and insert a new Thread entry.
uint32_t STDCALL thread_destroy (THREAD_HANDLE thread)
 Destroy and remove an existing Thread entry.
THREAD_HANDLE STDCALL thread_get_current (void)
 Get the Handle of currently executing thread.
uint32_t STDCALL thread_set_current (THREAD_HANDLE thread)
 Set the Handle of currently executing thread.
uint32_t STDCALL thread_get_name (THREAD_HANDLE thread, char *name, uint32_t len)
 Get the name of a Thread.
uint32_t STDCALL thread_set_name (THREAD_HANDLE thread, const char *name)
 Set the name of a Thread.
uint32_t STDCALL thread_get_cpu (THREAD_HANDLE thread)
 Get the current CPU of a thread (eg CPU_ID_0).
uint32_t STDCALL thread_set_cpu (THREAD_HANDLE thread, uint32_t cpu)
 Set the current CPU of a thread (eg CPU_ID_0).
uint32_t STDCALL thread_get_state (THREAD_HANDLE thread)
 Get the current state of a thread (eg THREAD_STATE_SUSPENDED).
uint32_t STDCALL thread_get_flags (THREAD_HANDLE thread)
 Get the current flags of a thread.
uint32_t STDCALL thread_set_flags (THREAD_HANDLE thread, uint32_t flags)
 Set the current flags of a thread.
uint32_t STDCALL thread_add_flags (THREAD_HANDLE thread, uint32_t flags)
 Add flags to the current flags of a thread.
uint32_t STDCALL thread_remove_flags (THREAD_HANDLE thread, uint32_t flags)
 Remove flags from the current flags of a thread.
LCID STDCALL thread_get_locale (THREAD_HANDLE thread)
 Get the current locale of a thread.
uint32_t STDCALL thread_set_locale (THREAD_HANDLE thread, LCID locale)
 Set the locale of a thread.
uint32_t STDCALL thread_get_times (THREAD_HANDLE thread, int64_t *createtime, int64_t *exittime, int64_t *kerneltime)
 Get the current times of a thread.
uint32_t STDCALL thread_get_switch_count (THREAD_HANDLE thread, int64_t *switchcount)
 Get the current context switch count of a thread (How many times the thread has been scheduled).
uint32_t STDCALL thread_get_stack_free (void)
 Get the free stack size of the current thread.
uint32_t STDCALL thread_get_stack_size (THREAD_HANDLE thread)
 Get the current stack size of a thread.
size_t STDCALL thread_get_stack_base (THREAD_HANDLE thread)
 Get the current stack base of a thread.
uint32_t STDCALL thread_set_stack_base (THREAD_HANDLE thread, size_t stackbase)
 Set the current stack base of a thread.
size_t STDCALL thread_get_stack_pointer (THREAD_HANDLE thread)
 Get the current stack pointer of a thread.
uint32_t STDCALL thread_get_exit_code (THREAD_HANDLE thread)
 Get the exit code of a Thread.
uint32_t STDCALL thread_get_affinity (THREAD_HANDLE thread)
 Get the scheduling affinity of a Thread.
uint32_t STDCALL thread_set_affinity (THREAD_HANDLE thread, uint32_t affinity)
 Set the scheduling affinity of a Thread.
uint32_t STDCALL thread_get_priority (THREAD_HANDLE thread)
 Get the scheduling priority of a Thread.
uint32_t STDCALL thread_set_priority (THREAD_HANDLE thread, uint32_t priority)
 Set the scheduling priority of a Thread.
uint32_t STDCALL thread_get_last_error (void)
 Get the last error value for the current Thread.
void STDCALL thread_set_last_error (uint32_t lasterror)
 Set the last error value for the current Thread.
uint32_t STDCALL thread_set_last_error_ex (uint32_t lasterror)
 Set the last error value for the current Thread.
uint32_t STDCALL thread_get_wait_result (void)
 Get the result of the last wait timeout for the current Thread.
uint32_t STDCALL thread_get_receive_result (void)
 Get the result of the last receive timeout for the current Thread.
uint32_t STDCALL thread_get_tls_index (uint32_t tlsindex)
 Get the current status of a TLS index in the TLS index table.
uint32_t STDCALL thread_alloc_tls_index (void)
 Allocate a TLS index in the TLS index table.
uint32_t STDCALL thread_alloc_tls_index_ex (uint32_t flags)
 Allocate a TLS index in the TLS index table.
uint32_t STDCALL thread_release_tls_index (uint32_t tlsindex)
 Deallocate a TLS index from the TLS index table.
void *STDCALL thread_get_tls_value (uint32_t tlsindex)
 Get the pointer associated with the TLS index for the current thread.
uint32_t STDCALL thread_set_tls_value (uint32_t tlsindex, void *tlsvalue)
 Set the pointer associated with the TLS index for the current thread.
void *STDCALL thread_get_tls_pointer (THREAD_HANDLE thread)
 Get the RTL TLS (Thread Local Storage) pointer of a Thread.
uint32_t STDCALL thread_set_tls_pointer (THREAD_HANDLE thread, void *tlspointer)
 Set the RTL TLS (Thread Local Storage) pointer of a Thread.
uint32_t STDCALL thread_ready (THREAD_HANDLE thread, BOOL reschedule)
 Place the supplied Thread on the ready queue.
uint32_t STDCALL thread_timeout (THREAD_HANDLE thread)
 Place the supplied Thread on the ready queue after a timeout waiting on a resource.
uint32_t STDCALL thread_wake (THREAD_HANDLE thread)
 Remove a thread prematurely from the sleep or timeout queues.
uint32_t STDCALL thread_migrate (THREAD_HANDLE thread, uint32_t cpu)
 Migrate a thread to a new CPU.
void STDCALL thread_end (uint32_t exitcode)
 Terminate the current Thread.
uint32_t STDCALL thread_halt (uint32_t exitcode)
 Halt the current thread so it will never be rescheduled.
uint32_t STDCALL thread_terminate (THREAD_HANDLE thread, uint32_t exitcode)
 Terminate but do not destroy the supplied Thread.
uint32_t STDCALL thread_yield (void)
 Make the current thread yield the processor (Same as ThreadSleep(0)).
uint32_t STDCALL thread_sleep (uint32_t milliseconds)
 Place the current thread on the sleep queue for a specified number of milliseconds.
uint32_t STDCALL thread_wait (LIST_HANDLE list, SPIN_HANDLE lock, uint32_t flags)
 Put the current thread into a wait state on the supplied list.
uint32_t STDCALL thread_wait_ex (LIST_HANDLE list, SPIN_HANDLE lock, uint32_t flags, uint32_t timeout)
 Put the current thread into a wait state with timeout on the supplied list.
uint32_t STDCALL thread_release (LIST_HANDLE list)
 Release the first thread waiting on the supplied list.
uint32_t STDCALL thread_abandon (LIST_HANDLE list)
 Release the first thread waiting on the supplied list and return with WAIT_ABANDONED.
uint32_t STDCALL thread_wait_terminate (THREAD_HANDLE thread, uint32_t timeout)
 Make the current thread wait until the specified thread has terminated.
uint32_t STDCALL thread_suspend (THREAD_HANDLE thread)
 Suspend a thread, placing it in hibernation.
uint32_t STDCALL thread_resume (THREAD_HANDLE thread)
 Resume a suspended thread, making it ready.
uint32_t STDCALL thread_wait_message (void)
 Make the current thread wait until a message is received (indefinitely).
uint32_t STDCALL thread_send_message (THREAD_HANDLE thread, THREAD_MESSAGE *message)
 Send a message to another thread.
uint32_t STDCALL thread_receive_message (THREAD_MESSAGE *message)
 Make the current thread wait to receive a message (indefinitely).
uint32_t STDCALL thread_receive_message_ex (THREAD_MESSAGE *message, uint32_t timeout, BOOL remove)
 Make the current thread wait to receive a message.
uint32_t STDCALL thread_abandon_message (THREAD_HANDLE thread)
 Tell another thread to abandon waiting for a message.
uint32_t STDCALL thread_lock (THREAD_HANDLE thread)
 Lock a thread allowing access to internal structures such as the thread stack.
uint32_t STDCALL thread_unlock (THREAD_HANDLE thread)
 Unlok a thread that was locked by ThreadLock.
uint32_t STDCALL scheduler_check (uint32_t cpuid)
 Check if the sleep queue is empty, if not then decrement the first key Then check if the timeout queue is empty, if not then decrement the first key.
uint32_t STDCALL scheduler_wakeup (uint32_t cpuid)
 Remove all threads from the sleep queue that have no more time to sleep.
uint32_t STDCALL scheduler_expire (uint32_t cpuid)
 Remove all threads from the timeout queue that have no more time to wait.
THREAD_HANDLE STDCALL scheduler_switch (uint32_t cpuid, THREAD_HANDLE thread)
 Perform a preemptive thread switch operation under an interrupt handler.
THREAD_HANDLE STDCALL scheduler_select (uint32_t cpuid, THREAD_HANDLE thread, BOOL yield)
 Select the next thread to be run based on state, yield, quantum and priority.
uint32_t STDCALL scheduler_reschedule (BOOL yield)
 Perform a thread switch operation when a thread yields, sleeps or waits.
uint32_t STDCALL scheduler_migration_enable (void)
 Enable scheduler thread migration.
uint32_t STDCALL scheduler_migration_disable (void)
 Disable scheduler thread migration.
uint32_t STDCALL scheduler_preempt_enable (uint32_t cpuid)
 Enable thread preemption for the specified CPU.
uint32_t STDCALL scheduler_preempt_disable (uint32_t cpuid)
 Disable thread preemption for the specified CPU.
uint32_t STDCALL scheduler_allocation_enable (uint32_t cpuid)
 Enable thread allocation for the specified CPU.
uint32_t STDCALL scheduler_allocation_disable (uint32_t cpuid)
 Disable thread allocation for the specified CPU.
MESSAGESLOT_HANDLE STDCALL messageslot_create (void)
 Create and insert a new Messageslot entry.
MESSAGESLOT_HANDLE STDCALL messageslot_create_ex (uint32_t maximum, uint32_t flags)
 Create and insert a new Messageslot entry.
uint32_t STDCALL messageslot_destroy (MESSAGESLOT_HANDLE messageslot)
 Destroy and remove an existing Messageslot entry.
uint32_t STDCALL messageslot_count (MESSAGESLOT_HANDLE messageslot)
 Get the number of available messages in a Messageslot entry.
uint32_t STDCALL messageslot_send (MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
 Send a message to a Messageslot.
uint32_t STDCALL messageslot_receive (MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
 Receive a message from a Messageslot.
uint32_t STDCALL messageslot_receive_ex (MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message, uint32_t timeout)
 Receive a message from a Messageslot.
MAILSLOT_HANDLE STDCALL mailslot_create (uint32_t maximum)
 Create and insert a new Mailslot entry.
uint32_t STDCALL mailslot_destroy (MAILSLOT_HANDLE mailslot)
 Destroy and remove an existing Mailslot entry.
uint32_t STDCALL mailslot_count (MAILSLOT_HANDLE mailslot)
 Get the number of available messages in a Mailslot entry.
uint32_t STDCALL mailslot_send (MAILSLOT_HANDLE mailslot, ssize_t data)
 Send a message to a Mailslot.
uint32_t STDCALL mailslot_send_ex (MAILSLOT_HANDLE mailslot, ssize_t data, uint32_t timeout)
 Send a message to a Mailslot.
ssize_t STDCALL mailslot_receive (MAILSLOT_HANDLE mailslot)
 Receive a message from a Mailslot.
ssize_t STDCALL mailslot_receive_ex (MAILSLOT_HANDLE mailslot, uint32_t timeout)
 Receive a message from a Mailslot.
BUFFER_HANDLE STDCALL buffer_create (uint32_t size, uint32_t count)
 Create and insert a new Buffer entry.
BUFFER_HANDLE STDCALL buffer_create_ex (uint32_t size, uint32_t count, uint32_t flags)
 Create and insert a new Buffer entry.
uint32_t STDCALL buffer_destroy (BUFFER_HANDLE buffer)
 Destroy and remove an existing Buffer entry.
uint32_t STDCALL buffer_count (BUFFER_HANDLE buffer)
 Get the total count of buffers in an existing Buffer entry.
uint32_t STDCALL buffer_available (BUFFER_HANDLE buffer)
 Get the available count of buffers in an existing Buffer entry.
void *STDCALL buffer_get (BUFFER_HANDLE buffer)
 Allocate an available buffer from an existing Buffer entry.
void *STDCALL buffer_get_ex (BUFFER_HANDLE buffer, uint32_t timeout)
 Allocate an available buffer from an existing Buffer entry.
uint32_t STDCALL buffer_free (void *buffer)
 Release a allocated buffer from an existing Buffer entry.
void *STDCALL buffer_iterate (BUFFER_HANDLE buffer, void *previous)
 Iterate through each of the buffers in an existing Buffer entry.
EVENT_HANDLE STDCALL event_create (BOOL manualreset, BOOL initialstate)
 Create and insert a new Event entry.
EVENT_HANDLE STDCALL event_create_ex (uint32_t flags)
 Create and insert a new Event entry.
uint32_t STDCALL event_destroy (EVENT_HANDLE event)
 Destroy and remove an existing Event entry.
uint32_t STDCALL event_state (EVENT_HANDLE event)
 Get the current state of an existing Event entry.
uint32_t STDCALL event_wait (EVENT_HANDLE event)
 Wait on an existing Event entry.
uint32_t STDCALL event_wait_ex (EVENT_HANDLE event, uint32_t timeout)
 Wait on an existing Event entry.
uint32_t STDCALL event_set (EVENT_HANDLE event)
 Set (Signal) an existing Event entry.
uint32_t STDCALL event_reset (EVENT_HANDLE event)
 Reset (Unsignal) an existing Event entry.
uint32_t STDCALL event_pulse (EVENT_HANDLE event)
 Pulse (Set then Reset) an existing Event entry.
TIMER_HANDLE STDCALL timer_create (uint32_t interval, BOOL enabled, BOOL reschedule, timer_event_proc event, void *data)
 Create and insert a new Timer entry.
TIMER_HANDLE STDCALL timer_create_ex (uint32_t interval, uint32_t state, uint32_t flags, timer_event_proc event, void *data)
 Create and insert a new Timer entry.
uint32_t STDCALL timer_destroy (TIMER_HANDLE timer)
 Destroy and remove an existing Timer entry.
uint32_t STDCALL timer_enable (TIMER_HANDLE timer)
 Enable an existing Timer entry (Timer events will be generated).
uint32_t STDCALL timer_enable_ex (TIMER_HANDLE timer, uint32_t interval, timer_event_proc event, void *data)
 Enable and update an existing Timer entry (Timer events will be generated).
uint32_t STDCALL timer_disable (TIMER_HANDLE timer)
 Disable an existing Timer entry (Timer events will not be generated).
TIMER_HANDLE STDCALL timer_dequeue (void)
 Get and remove the first timer from the Timer list.
int STDCALL timer_first_key (void)
 Get the first Key value from the Timer list.
uint32_t STDCALL timer_insert_key (TIMER_HANDLE timer, int key)
 Insert the supplied timer in the Timer list in delta ascending order based on Key.
uint32_t STDCALL timer_delete_key (TIMER_HANDLE timer)
 Delete the supplied timer from the Timer list.
int STDCALL timer_decrement_key (void)
 Decrement the first Key value in the Timer list.
BOOL STDCALL timer_is_empty (void)
 Check if the Timer list is empty.
BOOL STDCALL timer_not_empty (void)
 Check if the Timer list is not empty.
uint32_t STDCALL timer_check (void)
 Check if the timer list is empty, if not then decrement the first key.
uint32_t STDCALL timer_trigger (void)
 Remove all entries from the timer list that have reached their interval.
uint32_t STDCALL worker_schedule (uint32_t interval, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread now or in the future.
WORKER_HANDLE STDCALL worker_schedule_ex (uint32_t interval, uint32_t flags, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread now or in the future.
uint32_t STDCALL worker_cancel (WORKER_HANDLE worker)
 Cancel a previously scheduled worker thread task.
uint32_t STDCALL worker_schedule_irq (uint32_t affinity, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread when the caller is an IRQ handler.
uint32_t STDCALL worker_schedule_irq_ex (uint32_t affinity, uint32_t flags, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread when the caller is an IRQ handler.
uint32_t STDCALL worker_schedule_fiq (uint32_t affinity, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread when the caller is an FIQ handler.
uint32_t STDCALL worker_schedule_fiq_ex (uint32_t affinity, uint32_t flags, worker_task_proc task, void *data, worker_cb callback)
 Schedule a task to be performed by a worker thread when the caller is an FIQ handler.
uint32_t STDCALL worker_increase (uint32_t count)
 Increase the number of worker threads available.
uint32_t STDCALL worker_increase_ex (uint32_t count, BOOL priority)
 Increase the number of worker threads available.
uint32_t STDCALL worker_decrease (uint32_t count)
 Decrease the number of worker threads available.
uint32_t STDCALL worker_decrease_ex (uint32_t count, BOOL priority)
 Decrease the number of worker threads available.
uint32_t STDCALL tasker_thread_send_message (THREAD_HANDLE thread, THREAD_MESSAGE *message)
 Perform a ThreadSendMessage() function call using the tasker list.
uint32_t STDCALL tasker_messageslot_send (MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
 Perform a MessageslotSend() function call using the tasker list.
uint32_t STDCALL tasker_semaphore_signal (SEMAPHORE_HANDLE semaphore, uint32_t count)
 Perform a SemaphoreSignal() function call using the tasker list.
uint32_t STDCALL tasker_completion_reset (COMPLETION_HANDLE completion)
 Perform a CompletionReset() function call using the tasker list.
uint32_t STDCALL tasker_completion_complete (COMPLETION_HANDLE completion, BOOL all)
 Perform a CompletionComplete() or CompletionCompleteAll() function call using the tasker list.
uint32_t STDCALL tasker_enqueue (TASKER_TASK *task)
 Add the supplied task to the end of the Tasker list.
TASKER_TASK *STDCALL tasker_dequeue (void)
 Get and remove the first task from the Tasker list.
uint32_t STDCALL tasker_check (void)
 Check if the tasker list is empty or contains tasks.
uint32_t STDCALL tasker_trigger (void)
 Dequeue all tasks in the tasker list and perform the requested task for each.
THREAD_ID STDCALL begin_thread (void *signalaction, size_t stacksize, thread_func threadfunction, void *threadparameter, uint32_t creationflags, THREAD_ID *threadid)
 Start a new thread.
THREAD_ID STDCALL begin_thread_ex (void *signalaction, size_t stacksize, thread_func threadfunction, void *threadparameter, uint32_t creationflags, uint32_t priority, uint32_t affinity, uint32_t cpu, const char *name, THREAD_ID *threadid)
 Start a new thread.
void STDCALL end_thread (uint32_t exitcode)
 End the current thread.
uint32_t STDCALL spin_get_count (void)
 Get the current spin lock count.
uint32_t STDCALL mutex_get_count (void)
 Get the current mutex count.
uint32_t STDCALL critical_section_get_count (void)
 Get the current critical section count.
uint32_t STDCALL semaphore_get_count (void)
 Get the current semaphore count.
uint32_t STDCALL synchronizer_get_count (void)
 Get the current synchronizer count.
uint32_t STDCALL condition_get_count (void)
 Get the current condition count.
uint32_t STDCALL completion_get_count (void)
 Get the current completion count.
uint32_t STDCALL list_get_count (void)
 Get the current list count.
uint32_t STDCALL queue_get_count (void)
 Get the current queue count.
uint32_t STDCALL thread_get_count (void)
 Get the current thread count.
uint32_t STDCALL thread_tls_get_count (void)
 Get the current thread tls count.
void *STDCALL thread_allocate_stack (uint32_t stacksize)
 Allocate memory for a new thread stack.
void STDCALL thread_release_stack (void *stackbase, uint32_t stacksize)
 Release a thread stack allocated with ThreadAllocateStack.
void *STDCALL thread_setup_stack (void *stackbase, thread_start_proc startproc, thread_end_proc returnproc, void *parameter)
THREAD_SNAPSHOT *STDCALL thread_snapshot_create (void)
uint32_t STDCALL thread_snapshot_destroy (THREAD_SNAPSHOT *snapshot)
uint32_t STDCALL messageslot_get_count (void)
 Get the current messageslot count.
uint32_t STDCALL mailslot_get_count (void)
 Get the current mailslot count.
uint32_t STDCALL buffer_get_count (void)
 Get the current buffer count.
uint32_t STDCALL event_get_count (void)
 Get the current event count.
uint32_t STDCALL timer_get_count (void)
 Get the current timer count.
uint32_t STDCALL worker_get_count (void)
 Get the current worker thread count.
uint32_t STDCALL worker_get_priority_count (void)
 Get the current worker priority thread count.
uint32_t STDCALL tasker_get_count (void)
 Get the current tasker count.
uint32_t STDCALL list_type_to_string (uint32_t listtype, char *string, uint32_t len)
uint32_t STDCALL queue_type_to_string (uint32_t queuetype, char *string, uint32_t len)
uint32_t STDCALL thread_type_to_string (uint32_t threadtype, char *string, uint32_t len)
uint32_t STDCALL thread_state_to_string (uint32_t threadstate, char *string, uint32_t len)
uint32_t STDCALL thread_priority_to_string (uint32_t threadpriority, char *string, uint32_t len)
uint32_t STDCALL scheduler_get_list_flags (uint32_t listtype)
 Get the list flags for the specified type of list.
uint32_t STDCALL scheduler_get_queue_flags (uint32_t queuetype)
 Get the queue flags for the specified type of scheduler queue.
QUEUE_HANDLE STDCALL scheduler_get_queue_handle (uint32_t cpuid, uint32_t queuetype)
 Get the queue handle for the specified type of scheduler queue on the specified CPU.
QUEUE_HANDLE STDCALL scheduler_get_queue_handle_ex (uint32_t cpuid, uint32_t priority)
 Get the queue handle for the specified thread priority on the specified CPU.
uint32_t STDCALL scheduler_get_thread_count (uint32_t cpuid)
 Get the thread count for the specified CPU.
uint32_t STDCALL scheduler_get_thread_quantum (uint32_t cpuid)
 Get the current thread quantum for the specified CPU.
THREAD_HANDLE STDCALL scheduler_get_thread_handle (uint32_t cpuid, uint32_t threadtype)
 Get the thread handle for the specified type of thread on the specified CPU.
uint32_t STDCALL scheduler_get_priority_mask (uint32_t cpuid)
 Get the current priority mask for the specified CPU.
uint32_t STDCALL scheduler_get_priority_quantum (uint32_t priority)
 Get the scheduler quantum for the specified thread priority.
uint32_t STDCALL scheduler_set_priority_quantum (uint32_t priority, uint32_t quantum)
 Set the scheduler quantum for the specified thread priority.
uint32_t STDCALL scheduler_get_migration_quantum (void)
 Get the current migration quantum.
uint32_t STDCALL scheduler_get_starvation_quantum (uint32_t cpuid)
 Get the current starvation quantum for the specified CPU.
uint32_t STDCALL scheduler_get_thread_next (void)
 Get the next CPU for thread allocation.
uint32_t STDCALL scheduler_get_thread_migration (void)
 Get the current thread migration setting.
uint32_t STDCALL scheduler_get_thread_preempt (uint32_t cpuid)
 Get the current thread preempt setting for the specified CPU.
uint32_t STDCALL scheduler_get_thread_allocation (uint32_t cpuid)
 Get the current thread allocation setting for the specified CPU.
uint32_t STDCALL scheduler_migration_to_string (uint32_t migration, char *string, uint32_t len)
uint32_t STDCALL scheduler_preempt_to_string (uint32_t preempt, char *string, uint32_t len)
uint32_t STDCALL scheduler_allocation_to_string (uint32_t allocation, char *string, uint32_t len)
uint32_t STDCALL timer_get_list_flags (void)
 Get the lock flags for the timer list.
uint32_t STDCALL timer_get_messageslot_flags (void)
 Get the lock flags for the timer messageslot.
uint32_t STDCALL worker_get_messageslot_flags (void)
 Get the lock flags for the worker messageslot.

Macro Definition Documentation

◆ LOCK_FLAG_NONE

#define LOCK_FLAG_NONE   0x00000000

Thread specific constants Lock constants

◆ LOCK_FLAG_IRQ

#define LOCK_FLAG_IRQ   0x00000001

◆ LOCK_FLAG_FIQ

#define LOCK_FLAG_FIQ   0x00000002

◆ LOCK_FLAG_IRQFIQ

#define LOCK_FLAG_IRQFIQ   0x00000004

◆ SPIN_SIGNATURE

#define SPIN_SIGNATURE   0x0FEC3B82

Spin constants

◆ SPIN_STATE_UNLOCKED

#define SPIN_STATE_UNLOCKED   0

Spin state constants

◆ SPIN_STATE_LOCKED

#define SPIN_STATE_LOCKED   1

◆ MUTEX_SIGNATURE

#define MUTEX_SIGNATURE   0x1C5D7FA4

Mutex constants

◆ MUTEX_STATE_UNLOCKED

#define MUTEX_STATE_UNLOCKED   0

Mutex state constants

◆ MUTEX_STATE_LOCKED

#define MUTEX_STATE_LOCKED   1

◆ MUTEX_FLAG_NONE

#define MUTEX_FLAG_NONE   0x00000000

Mutex flags constants

◆ MUTEX_FLAG_RECURSIVE

#define MUTEX_FLAG_RECURSIVE   0x00000001

Mutex can be locked multiple times by the same thread if set (Must be unlocked the same number of times).

◆ MUTEX_FLAG_ERRORCHECK

#define MUTEX_FLAG_ERRORCHECK   0x00000002

Mutex will perform a deadlock check if set, will return with an error if already owned by the same thread (and not recursive).

◆ CRITICAL_SECTION_SIGNATURE

#define CRITICAL_SECTION_SIGNATURE   0x25F3AE01

Critical Section constants

◆ CRITICAL_SECTION_STATE_UNLOCKED

#define CRITICAL_SECTION_STATE_UNLOCKED   0

Critical Section state constants

◆ CRITICAL_SECTION_STATE_LOCKED

#define CRITICAL_SECTION_STATE_LOCKED   1

◆ SEMAPHORE_SIGNATURE

#define SEMAPHORE_SIGNATURE   0x390A1EB4

Semaphore constants

◆ SEMAPHORE_FLAG_NONE

#define SEMAPHORE_FLAG_NONE   LOCK_FLAG_NONE

Semaphore flag constants

◆ SEMAPHORE_FLAG_IRQ

#define SEMAPHORE_FLAG_IRQ   LOCK_FLAG_IRQ

◆ SEMAPHORE_FLAG_FIQ

#define SEMAPHORE_FLAG_FIQ   LOCK_FLAG_FIQ

◆ SEMAPHORE_FLAG_IRQFIQ

#define SEMAPHORE_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ

◆ SYNCHRONIZER_SIGNATURE

#define SYNCHRONIZER_SIGNATURE   0xC5D081FB

Synchronizer constants

◆ SYNCHRONIZER_STATE_UNLOCKED

#define SYNCHRONIZER_STATE_UNLOCKED   0

Synchronizer state constants

◆ SYNCHRONIZER_STATE_READER_LOCKED

#define SYNCHRONIZER_STATE_READER_LOCKED   1

◆ SYNCHRONIZER_STATE_WRITER_LOCKED

#define SYNCHRONIZER_STATE_WRITER_LOCKED   2

◆ SYNCHRONIZER_FLAG_NONE

#define SYNCHRONIZER_FLAG_NONE   0x00000000

Synchronizer flag constants

◆ SYNCHRONIZER_FLAG_READ_PRIORITY

#define SYNCHRONIZER_FLAG_READ_PRIORITY   0x00000001

Synchronizer prioritises readers over writers.

◆ SYNCHRONIZER_FLAG_WRITE_PRIORITY

#define SYNCHRONIZER_FLAG_WRITE_PRIORITY   0x00000002

Synchronizer prioritises writers over readers.

◆ CONDITION_SIGNATURE

#define CONDITION_SIGNATURE   0xD14D3C0A

Condition constants

◆ CONDITION_FLAG_NONE

#define CONDITION_FLAG_NONE   0x00000000

Condition flag constants

◆ CONDITION_LOCK_FLAG_NONE

#define CONDITION_LOCK_FLAG_NONE   0x00000000

Condition lock flag constants

◆ CONDITION_LOCK_FLAG_WRITER

#define CONDITION_LOCK_FLAG_WRITER   0x00000001

Condition should release and acquire the writer lock on a Synchronizer when ConditionWaitSynchronizer is called (otherwise release and acquire the reader lock).

◆ COMPLETION_SIGNATURE

#define COMPLETION_SIGNATURE   0xFCE24CA1

Completion constants

◆ COMPLETION_STATE_RESET

#define COMPLETION_STATE_RESET   0

Completion state constants

◆ COMPLETION_STATE_COMPLETE

#define COMPLETION_STATE_COMPLETE   1

◆ COMPLETION_FLAG_NONE

#define COMPLETION_FLAG_NONE   LOCK_FLAG_NONE

Completion flag constants

◆ COMPLETION_FLAG_IRQ

#define COMPLETION_FLAG_IRQ   LOCK_FLAG_IRQ

Disable IRQ during completion operations (Wait/Reset/Complete).

◆ COMPLETION_FLAG_FIQ

#define COMPLETION_FLAG_FIQ   LOCK_FLAG_FIQ

Disable FIQ during completion operations (Wait/Reset/Complete).

◆ COMPLETION_FLAG_IRQFIQ

#define COMPLETION_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ

Disable IRQ and FIQ during completion operations (Wait/Reset/Complete).

◆ COMPLETION_FLAG_COUNTED

#define COMPLETION_FLAG_COUNTED   0x00000008

Use a counted value instead of a single state (Affects behaviour of Wait and Complete).

◆ LIST_SIGNATURE

#define LIST_SIGNATURE   0x4A98BE2A

List constants

◆ LIST_TYPE_NOT_SPECIFIED

#define LIST_TYPE_NOT_SPECIFIED   0

A generic thread list without a specific purpose.

List type constants

◆ LIST_TYPE_WAIT_SECTION

#define LIST_TYPE_WAIT_SECTION   1

A Critical Section Wait List.

◆ LIST_TYPE_WAIT_SEMAPHORE

#define LIST_TYPE_WAIT_SEMAPHORE   2

A Semaphore Wait List.

◆ LIST_TYPE_WAIT_SYNCHRONIZER

#define LIST_TYPE_WAIT_SYNCHRONIZER   3

A Synchronizer Wait List.

◆ LIST_TYPE_WAIT_CONDITION

#define LIST_TYPE_WAIT_CONDITION   4

A Condition Wait List.

◆ LIST_TYPE_WAIT_COMPLETION

#define LIST_TYPE_WAIT_COMPLETION   5

A Condition Wait List.

◆ LIST_TYPE_WAIT_EVENT

#define LIST_TYPE_WAIT_EVENT   6

An Event Wait List.

◆ LIST_TYPE_WAIT_THREAD

#define LIST_TYPE_WAIT_THREAD   7

A Thread Wait List.

◆ LIST_TYPE_WAIT_MESSAGESLOT

#define LIST_TYPE_WAIT_MESSAGESLOT   8

A Messageslot Wait List.

◆ LIST_TYPE_WAIT_OTHER

#define LIST_TYPE_WAIT_OTHER   9

Another type of Wait List (Suitable for passing to ThreadWait/ThreadWaitEx/ThreadWaitMultiple/ThreadRelease).

◆ LIST_FLAG_NONE

#define LIST_FLAG_NONE   LOCK_FLAG_NONE

List flag constants

◆ LIST_FLAG_IRQ

#define LIST_FLAG_IRQ   LOCK_FLAG_IRQ

◆ LIST_FLAG_FIQ

#define LIST_FLAG_FIQ   LOCK_FLAG_FIQ

◆ LIST_FLAG_IRQFIQ

#define LIST_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ

◆ QUEUE_SIGNATURE

#define QUEUE_SIGNATURE   0x57A3BF9E

Queue constants

◆ QUEUE_TYPE_NOT_SPECIFIED

#define QUEUE_TYPE_NOT_SPECIFIED   0

A generic thread queue without a specific purpose.

Queue type constants

◆ QUEUE_TYPE_SCHEDULE_SLEEP

#define QUEUE_TYPE_SCHEDULE_SLEEP   1

A Scheduler Sleep Queue.

◆ QUEUE_TYPE_SCHEDULE_TIMEOUT

#define QUEUE_TYPE_SCHEDULE_TIMEOUT   2

A Scheduler Timeout Queue.

◆ QUEUE_TYPE_SCHEDULE_TERMINATION

#define QUEUE_TYPE_SCHEDULE_TERMINATION   3

A Scheduler Termination Queue (Threads are placed on termination queue when they exit or are terminated).

◆ QUEUE_TYPE_SCHEDULE_NONE

#define QUEUE_TYPE_SCHEDULE_NONE   4

A Scheduler No Priority Queue (Only used for IRQ/FIQ threads which are never selected for scheduling).

◆ QUEUE_TYPE_SCHEDULE_IDLE

#define QUEUE_TYPE_SCHEDULE_IDLE   5

A Scheduler Idle Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_LOWEST

#define QUEUE_TYPE_SCHEDULE_LOWEST   6

A Scheduler Lowest Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_LOWER

#define QUEUE_TYPE_SCHEDULE_LOWER   7

A Scheduler Lower Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_NORMAL

#define QUEUE_TYPE_SCHEDULE_NORMAL   8

A Scheduler Normal Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_HIGHER

#define QUEUE_TYPE_SCHEDULE_HIGHER   9

A Scheduler Higher Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_HIGHEST

#define QUEUE_TYPE_SCHEDULE_HIGHEST   10

A Scheduler Highest Priority Queue.

◆ QUEUE_TYPE_SCHEDULE_CRITICAL

#define QUEUE_TYPE_SCHEDULE_CRITICAL   11

A Scheduler Critical Priority Queue.

◆ QUEUE_FLAG_NONE

#define QUEUE_FLAG_NONE   LOCK_FLAG_NONE

Queue flag constants

◆ QUEUE_FLAG_IRQ

#define QUEUE_FLAG_IRQ   LOCK_FLAG_IRQ

◆ QUEUE_FLAG_FIQ

#define QUEUE_FLAG_FIQ   LOCK_FLAG_FIQ

◆ QUEUE_FLAG_IRQFIQ

#define QUEUE_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ

◆ QUEUE_FLAG_DESCENDING

#define QUEUE_FLAG_DESCENDING   0x00000008

◆ QUEUE_FLAG_DELTA

#define QUEUE_FLAG_DELTA   0x00000010

◆ QUEUE_KEY_NONE

#define QUEUE_KEY_NONE   (int32_t)0x7FFFFFFF

Null key value returned from an empty Queue.

Queue key constants

◆ QUEUE_KEY_MAX

#define QUEUE_KEY_MAX   (int32_t)0x7FFFFFFE

Max key that can be ordered in a Queue.

◆ QUEUE_KEY_MIN

#define QUEUE_KEY_MIN   (int32_t)0x80000000

Min key that can be ordered in a Queue.

◆ THREAD_SIGNATURE

#define THREAD_SIGNATURE   0x6C2BA10F

Thread constants

◆ THREAD_TYPE_NORMAL

#define THREAD_TYPE_NORMAL   0

A Normal thread (No special case handling).

Thread type constants

◆ THREAD_TYPE_IDLE

#define THREAD_TYPE_IDLE   1

An Idle thread (Used to calculate ultilization and provide an always ready thread).

◆ THREAD_TYPE_IRQ

#define THREAD_TYPE_IRQ   2

An IRQ thread (Used by the IRQ handler during interrupt time).

◆ THREAD_TYPE_FIQ

#define THREAD_TYPE_FIQ   3

An FIQ thread (Used by the FIQ handler during interrupt time).

◆ THREAD_TYPE_SWI

#define THREAD_TYPE_SWI   4

A Software Interrupt (SWI) thread (Used by the SWI handler during a system call).

◆ THREAD_FLAG_NONE

#define THREAD_FLAG_NONE   0x00000000

Thread flag constants

◆ THREAD_FLAG_PERSIST

#define THREAD_FLAG_PERSIST   0x00000001

If set thread handle will persist until explicitly destroyed (Otherwise destroyed after termination quantum has elapsed).

◆ THREAD_FLAG_CANCELLED

#define THREAD_FLAG_CANCELLED   0x00000002

Indicates that thread has been cancelled, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).

◆ THREAD_FLAG_CANCEL_DISABLE

#define THREAD_FLAG_CANCEL_DISABLE   0x00000004

Indicates that thread cancellation is disabled for a thread, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).

◆ THREAD_FLAG_CANCEL_ASYNCHRONOUS

#define THREAD_FLAG_CANCEL_ASYNCHRONOUS   0x00000008

Indicates that asynchronous thread cancellation is enabled for a thread, for support of external thread APIs (eg pThreads)(Not used internally by Ultibo).

◆ THREAD_FLAG_INTERNAL

#define THREAD_FLAG_INTERNAL   THREAD_FLAG_NONE + 0x80000000

Note: Temporary value to avoid warning.

◆ THREAD_STATE_RUNNING

#define THREAD_STATE_RUNNING   1

Thread is currently running.

Thread state constants

◆ THREAD_STATE_READY

#define THREAD_STATE_READY   2

Thread is on ready queue.

◆ THREAD_STATE_SLEEP

#define THREAD_STATE_SLEEP   3

Thread is sleeping.

◆ THREAD_STATE_SUSPENDED

#define THREAD_STATE_SUSPENDED   4

Thread is suspended.

◆ THREAD_STATE_WAIT

#define THREAD_STATE_WAIT   5

Thread is on a wait list.

◆ THREAD_STATE_WAIT_TIMEOUT

#define THREAD_STATE_WAIT_TIMEOUT   6

Thread is on a wait list with timeout.

◆ THREAD_STATE_RECEIVE

#define THREAD_STATE_RECEIVE   7

Thread is waiting to receive a message.

◆ THREAD_STATE_RECEIVE_TIMEOUT

#define THREAD_STATE_RECEIVE_TIMEOUT   8

Thread is waiting to receive a message with timeout.

◆ THREAD_STATE_HALTED

#define THREAD_STATE_HALTED   9

Thread has been halted (Due to an unhandled exception etc).

◆ THREAD_STATE_TERMINATED

#define THREAD_STATE_TERMINATED   10

Thread has been terminated

◆ THREAD_PRIORITY_NONE

#define THREAD_PRIORITY_NONE   0

To Do THREAD_STATE_SEND / THREAD_STATE_SEND_TIMEOUT ? //Who would wake them up ? //Timeout is ok, but what about send only ?

Thread priority constants Only used for IRQ/FIQ threads which are never selected for scheduling

◆ THREAD_PRIORITY_IDLE

#define THREAD_PRIORITY_IDLE   1

◆ THREAD_PRIORITY_LOWEST

#define THREAD_PRIORITY_LOWEST   2

◆ THREAD_PRIORITY_LOWER

#define THREAD_PRIORITY_LOWER   3

◆ THREAD_PRIORITY_NORMAL

#define THREAD_PRIORITY_NORMAL   4

◆ THREAD_PRIORITY_HIGHER

#define THREAD_PRIORITY_HIGHER   5

◆ THREAD_PRIORITY_HIGHEST

#define THREAD_PRIORITY_HIGHEST   6

◆ THREAD_PRIORITY_CRITICAL

#define THREAD_PRIORITY_CRITICAL   7

◆ THREAD_PRIORITY_DEFAULT

#define THREAD_PRIORITY_DEFAULT   THREAD_PRIORITY_NORMAL

Default thread priority.

◆ THREAD_PRIORITY_MINIMUM

#define THREAD_PRIORITY_MINIMUM   THREAD_PRIORITY_IDLE

Minimum thread priority.

◆ THREAD_PRIORITY_MAXIMUM

#define THREAD_PRIORITY_MAXIMUM   THREAD_PRIORITY_CRITICAL

Maximum thread priority.

◆ THREAD_PRIORITY_COUNT

#define THREAD_PRIORITY_COUNT   THREAD_PRIORITY_MAXIMUM + 1

Number of thread priority levels.

◆ THREAD_PRIORITY_BELOW_NORMAL

#define THREAD_PRIORITY_BELOW_NORMAL   THREAD_PRIORITY_LOWER

Additional priority aliases for compatibility

◆ THREAD_PRIORITY_ABOVE_NORMAL

#define THREAD_PRIORITY_ABOVE_NORMAL   THREAD_PRIORITY_HIGHER

◆ THREAD_PRIORITY_TIME_CRITICAL

#define THREAD_PRIORITY_TIME_CRITICAL   THREAD_PRIORITY_CRITICAL

◆ THREAD_NAME_LENGTH

#define THREAD_NAME_LENGTH   SIZE_64

Length of thread name.

Thread name constants

◆ IRQ_THREAD_NAME

#define IRQ_THREAD_NAME   "IRQ"

◆ FIQ_THREAD_NAME

#define FIQ_THREAD_NAME   "FIQ"

◆ SWI_THREAD_NAME

#define SWI_THREAD_NAME   "SWI"

◆ IDLE_THREAD_NAME

#define IDLE_THREAD_NAME   "Idle"

◆ MAIN_THREAD_NAME

#define MAIN_THREAD_NAME   "Main"

◆ TIMER_THREAD_NAME

#define TIMER_THREAD_NAME   "Timer"

◆ WORKER_THREAD_NAME

#define WORKER_THREAD_NAME   "Worker"

◆ TIMER_PRIORITY_THREAD_NAME

#define TIMER_PRIORITY_THREAD_NAME   "Priority Timer"

◆ WORKER_PRIORITY_THREAD_NAME

#define WORKER_PRIORITY_THREAD_NAME   "Priority Worker"

◆ RTL_THREAD_NAME

#define RTL_THREAD_NAME   "RTL Thread"

◆ TIMER_THREAD_PRIORITY

#define TIMER_THREAD_PRIORITY   THREAD_PRIORITY_NORMAL

Thread priority constants

◆ WORKER_THREAD_PRIORITY

#define WORKER_THREAD_PRIORITY   THREAD_PRIORITY_NORMAL

◆ TIMER_PRIORITY_THREAD_PRIORITY

#define TIMER_PRIORITY_THREAD_PRIORITY   THREAD_PRIORITY_HIGHEST

◆ WORKER_PRIORITY_THREAD_PRIORITY

#define WORKER_PRIORITY_THREAD_PRIORITY   THREAD_PRIORITY_HIGHER

◆ THREAD_CREATE_NONE

#define THREAD_CREATE_NONE   0x00000000

Thread create constants

◆ THREAD_CREATE_SUSPENDED

#define THREAD_CREATE_SUSPENDED   0x00000004

◆ THREAD_TLS_FREE

#define THREAD_TLS_FREE   0x00000000

Thread TLS constants

◆ THREAD_TLS_USED

#define THREAD_TLS_USED   0x00000001

◆ THREAD_TLS_INVALID

#define THREAD_TLS_INVALID   0xFFFFFFFF

◆ THREAD_TLS_MAXIMUM

#define THREAD_TLS_MAXIMUM   SIZE_64

The maximum number TLS index slots available.

◆ THREAD_TLS_FLAG_NONE

#define THREAD_TLS_FLAG_NONE   0x00000000

Thread TLS flag constants

◆ THREAD_TLS_FLAG_FREE

#define THREAD_TLS_FLAG_FREE   0x00000001

If set then pointer in thread TLS index will be freed on ThreadReleaseTlsIndex or ThreadDestroy.

◆ THREAD_LISTS_MAXIMUM

#define THREAD_LISTS_MAXIMUM   SIZE_64

Maximum number of lists a thread can wait on at the same time.

Thread wait constants

◆ MESSAGESLOT_SIGNATURE

#define MESSAGESLOT_SIGNATURE   0xB631CE4B

Messageslot constants

◆ MESSAGESLOT_FLAG_NONE

#define MESSAGESLOT_FLAG_NONE   LOCK_FLAG_NONE

Messageslot flag constants

◆ MESSAGESLOT_FLAG_IRQ

#define MESSAGESLOT_FLAG_IRQ   LOCK_FLAG_IRQ

◆ MESSAGESLOT_FLAG_FIQ

#define MESSAGESLOT_FLAG_FIQ   LOCK_FLAG_FIQ

◆ MESSAGESLOT_FLAG_IRQFIQ

#define MESSAGESLOT_FLAG_IRQFIQ   LOCK_FLAG_IRQFIQ

◆ MAILSLOT_SIGNATURE

#define MAILSLOT_SIGNATURE   0x7A409BF3

Mailslot constants

◆ BUFFER_SIGNATURE

#define BUFFER_SIGNATURE   0x830BEA71

Buffer constants

◆ BUFFER_FLAG_NONE

#define BUFFER_FLAG_NONE   0x00000000

Buffer flag constants

◆ BUFFER_FLAG_SHARED

#define BUFFER_FLAG_SHARED   0x00000001

If set the buffer memory (Not the buffer entry itself) is allocated from shared memory.

◆ EVENT_SIGNATURE

#define EVENT_SIGNATURE   0x903BA69D

Event constants

◆ EVENT_STATE_UNSIGNALED

#define EVENT_STATE_UNSIGNALED   0

Event state constants

◆ EVENT_STATE_SIGNALED

#define EVENT_STATE_SIGNALED   1

◆ EVENT_FLAG_NONE

#define EVENT_FLAG_NONE   0x00000000

Event flag constants

◆ EVENT_FLAG_INITIAL_STATE

#define EVENT_FLAG_INITIAL_STATE   0x00000001

◆ EVENT_FLAG_MANUAL_RESET

#define EVENT_FLAG_MANUAL_RESET   0x00000002

◆ TIMER_SIGNATURE

#define TIMER_SIGNATURE   0xAB7E07FB

Timer constants

◆ TIMER_STATE_DISABLED

#define TIMER_STATE_DISABLED   0

Timer state constants

◆ TIMER_STATE_ENABLED

#define TIMER_STATE_ENABLED   1

◆ TIMER_FLAG_NONE

#define TIMER_FLAG_NONE   0x00000000

Timer flag constants

◆ TIMER_FLAG_RESCHEDULE

#define TIMER_FLAG_RESCHEDULE   0x00000001

Timer should be rescheduled each time the event completes.

◆ TIMER_FLAG_IMMEDIATE

#define TIMER_FLAG_IMMEDIATE   0x00000002

Timer event should be executed immediately and then each interval milliseconds.

◆ TIMER_FLAG_WORKER

#define TIMER_FLAG_WORKER   0x00000004

Timer event should be executed by a worker thread instead of a timer thread.

◆ TIMER_FLAG_PRIORITY

#define TIMER_FLAG_PRIORITY   0x00000008

Timer event should be executed by a priority timer thread.

◆ TIMER_KEY_NONE

#define TIMER_KEY_NONE   (int32_t)0x7FFFFFFF

Null key value returned from an empty Timer list.

Timer key constants

◆ TIMER_KEY_MAX

#define TIMER_KEY_MAX   (int32_t)0x7FFFFFFE

Max key that can be ordered in a Timer list.

◆ TIMER_KEY_MIN

#define TIMER_KEY_MIN   (int32_t)0x80000000

Min key that can be ordered in a Timer list.

◆ WORKER_SIGNATURE

#define WORKER_SIGNATURE   0xEF6A901B

Worker constants

◆ WORKER_FLAG_NONE

#define WORKER_FLAG_NONE   0x00000000

Worker flag constants

◆ WORKER_FLAG_RESCHEDULE

#define WORKER_FLAG_RESCHEDULE   0x00000001

Worker task should be rescheduled each time the task completes.

◆ WORKER_FLAG_IMMEDIATE

#define WORKER_FLAG_IMMEDIATE   0x00000002

Worker task should be executed immediately and then each interval milliseconds.

◆ WORKER_FLAG_CANCEL

#define WORKER_FLAG_CANCEL   0x00000004

Internal flag to indicate the worker task should be cancelled next time the interval expires.

◆ WORKER_FLAG_NOFREE

#define WORKER_FLAG_NOFREE   0x00000008

Internal flag to tell worker execute not to free the worker request when it is completed.

◆ WORKER_FLAG_TERMINATE

#define WORKER_FLAG_TERMINATE   0x00000010

Internal flag to tell worker execute to terminate the worker thread.

◆ WORKER_FLAG_IRQ

#define WORKER_FLAG_IRQ   0x00000020

Internal flag to tell worker execute to free IRQ memory when the request is completed.

◆ WORKER_FLAG_FIQ

#define WORKER_FLAG_FIQ   0x00000040

Internal flag to tell worker execute to free FIQ memory when the request is completed.

◆ WORKER_FLAG_PRIORITY

#define WORKER_FLAG_PRIORITY   0x00000080

Worker task should be executed by a priority worker thread.

◆ WORKER_FLAG_INTERNAL

Internal only flags.

◆ WORKER_FLAG_EXCLUDED_IRQ

#define WORKER_FLAG_EXCLUDED_IRQ   WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE

Excluded flags.

◆ WORKER_FLAG_EXCLUDED_FIQ

#define WORKER_FLAG_EXCLUDED_FIQ   WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE

Excluded flags.

◆ TASKER_TASK_THREADSENDMESSAGE

#define TASKER_TASK_THREADSENDMESSAGE   1

Perform a ThreadSendMessage() function using the tasker list.

Tasker task constants

◆ TASKER_TASK_MESSAGESLOTSEND

#define TASKER_TASK_MESSAGESLOTSEND   2

Perform a MessageslotSend() function using the tasker list.

◆ TASKER_TASK_SEMAPHORESIGNAL

#define TASKER_TASK_SEMAPHORESIGNAL   3

Perform a SemaphoreSignal() function using the tasker list.

◆ TASKER_TASK_COMPLETIONRESET

#define TASKER_TASK_COMPLETIONRESET   4

Perform a CompletionReset() function using the tasker list.

◆ TASKER_TASK_COMPLETIONCOMPLETE

#define TASKER_TASK_COMPLETIONCOMPLETE   5

Perform a CompletionComplete() or CompletionCompleteAll() function using the tasker list.

◆ SCHEDULER_MIGRATION_DISABLED

#define SCHEDULER_MIGRATION_DISABLED   0

Scheduler migration constants

◆ SCHEDULER_MIGRATION_ENABLED

#define SCHEDULER_MIGRATION_ENABLED   1

◆ SCHEDULER_PREEMPT_DISABLED

#define SCHEDULER_PREEMPT_DISABLED   0

Scheduler preempt constants

◆ SCHEDULER_PREEMPT_ENABLED

#define SCHEDULER_PREEMPT_ENABLED   1

◆ SCHEDULER_ALLOCATION_DISABLED

#define SCHEDULER_ALLOCATION_DISABLED   0

Scheduler allocation constants

◆ SCHEDULER_ALLOCATION_ENABLED

#define SCHEDULER_ALLOCATION_ENABLED   1

◆ SCHEDULER_MASK_NONE

#define SCHEDULER_MASK_NONE   (1 << THREAD_PRIORITY_NONE)

Scheduler mask constants

◆ SCHEDULER_MASK_IDLE

#define SCHEDULER_MASK_IDLE   (1 << THREAD_PRIORITY_IDLE)

◆ SCHEDULER_MASK_LOWEST

#define SCHEDULER_MASK_LOWEST   (1 << THREAD_PRIORITY_LOWEST)

◆ SCHEDULER_MASK_LOWER

#define SCHEDULER_MASK_LOWER   (1 << THREAD_PRIORITY_LOWER)

◆ SCHEDULER_MASK_NORMAL

#define SCHEDULER_MASK_NORMAL   (1 << THREAD_PRIORITY_NORMAL)

◆ SCHEDULER_MASK_HIGHER

#define SCHEDULER_MASK_HIGHER   (1 << THREAD_PRIORITY_HIGHER)

◆ SCHEDULER_MASK_HIGHEST

#define SCHEDULER_MASK_HIGHEST   (1 << THREAD_PRIORITY_HIGHEST)

◆ SCHEDULER_MASK_CRITICAL

#define SCHEDULER_MASK_CRITICAL   (1 << THREAD_PRIORITY_CRITICAL)

◆ SCHEDULER_QUANTUM_NONE

#define SCHEDULER_QUANTUM_NONE   0

Scheduler quantum constants

◆ SCHEDULER_QUANTUM_IDLE

#define SCHEDULER_QUANTUM_IDLE   0

◆ SCHEDULER_QUANTUM_LOWEST

#define SCHEDULER_QUANTUM_LOWEST   1

◆ SCHEDULER_QUANTUM_LOWER

#define SCHEDULER_QUANTUM_LOWER   2

◆ SCHEDULER_QUANTUM_NORMAL

#define SCHEDULER_QUANTUM_NORMAL   4

◆ SCHEDULER_QUANTUM_HIGHER

#define SCHEDULER_QUANTUM_HIGHER   6

◆ SCHEDULER_QUANTUM_HIGHEST

#define SCHEDULER_QUANTUM_HIGHEST   8

◆ SCHEDULER_QUANTUM_CRITICAL

#define SCHEDULER_QUANTUM_CRITICAL   10

Typedef Documentation

◆ SPIN_ENTRY

typedef struct _SPIN_ENTRY SPIN_ENTRY

Thread specific types See also Handle types in GlobalConst Spin entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ MUTEX_ENTRY

typedef struct _MUTEX_ENTRY MUTEX_ENTRY

Mutex entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ CRITICAL_SECTION_ENTRY

Critical Section entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ SEMAPHORE_ENTRY

Semaphore entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ SYNCHRONIZER_ENTRY

Synchronizer entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ CONDITION_ENTRY

Condition entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ COMPLETION_ENTRY

Completion entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ LIST_ELEMENT

typedef struct _LIST_ELEMENT LIST_ELEMENT

List entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ LIST_ENTRY

typedef struct _LIST_ENTRY LIST_ENTRY

◆ LIST_HANDLES

typedef LIST_HANDLE LIST_HANDLES[THREAD_LISTS_MAXIMUM]

List handles

◆ QUEUE_ELEMENT

typedef struct _QUEUE_ELEMENT QUEUE_ELEMENT

Queue entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ QUEUE_ENTRY

typedef struct _QUEUE_ENTRY QUEUE_ENTRY

◆ THREAD_MESSAGE

Message list

◆ MESSAGE_LIST

typedef struct _MESSAGE_LIST MESSAGE_LIST

◆ THREAD_ENTRY

typedef struct _THREAD_ENTRY THREAD_ENTRY

Thread entry Note: Changes to this structure need to be accounted for in platform specific handlers

◆ THREAD_SNAPSHOT

Thread snapshot

◆ MESSAGESLOT_ENTRY

Messageslot entry

◆ MAILSLOT_ENTRY

Mailslot entry

◆ BUFFER_ITEM

typedef struct _BUFFER_ITEM BUFFER_ITEM

Buffer entry

◆ BUFFER_ENTRY

typedef struct _BUFFER_ENTRY BUFFER_ENTRY

◆ EVENT_ENTRY

typedef struct _EVENT_ENTRY EVENT_ENTRY

Event entry

◆ TIMER_ITEM

typedef struct _TIMER_ITEM TIMER_ITEM

Timer list

◆ TIMER_LIST

typedef struct _TIMER_LIST TIMER_LIST

◆ TIMER_ENTRY

typedef struct _TIMER_ENTRY TIMER_ENTRY

Timer entry

◆ WORKER_REQUEST

Worker request

◆ TASKER_TASK

typedef struct _TASKER_TASK TASKER_TASK

Tasker list

◆ TASKER_LIST

typedef struct _TASKER_LIST TASKER_LIST

◆ TASKER_THREAD_SEND_MESSAGE

Tasker ThreadSendMessage task

◆ TASKER_MESSAGESLOT_SEND

Tasker MessageslotSend task

◆ TASKER_SEMAPHORE_SIGNAL

Tasker SemaphoreSignal task

◆ TASKER_SEMAPHORE_RESET

Tasker CompletionReset task

◆ TASKER_SEMAPHORE_COMPLETE

Tasker CompletionComplete task

◆ thread_start_proc

typedef ssize_t STDCALL(* thread_start_proc) (void *parameter)

Prototypes for Thread Start/End Handlers

◆ thread_end_proc

typedef void STDCALL(* thread_end_proc) (uint32_t exitcode)

Function Documentation

◆ spin_create()

SPIN_HANDLE STDCALL spin_create ( void )

Create and insert a new Spin entry.

Spin Functions

Returns
Handle of new Spin entry or INVALID_HANDLE_VALUE if entry could not be created

◆ spin_create_ex()

SPIN_HANDLE STDCALL spin_create_ex ( BOOL initialowner)

Create and insert a new Spin entry.

Parameters
InitialOwnerIf true set the state of the spin to locked and the owner to the current thread
Returns
Handle of new Spin entry or INVALID_HANDLE_VALUE if entry could not be created

◆ spin_destroy()

uint32_t STDCALL spin_destroy ( SPIN_HANDLE spin)

Destroy and remove an existing Spin entry.

Parameters
SpinHandle of Spin entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_owner()

THREAD_HANDLE STDCALL spin_owner ( SPIN_HANDLE spin)

Get the current owner of an existing Spin entry.

Parameters
SpinHandle of Spin entry to get owner for
Returns
Handle of owning thread or INVALID_HANDLE_VALUE if not currently owned

◆ spin_lock()

uint32_t STDCALL spin_lock ( SPIN_HANDLE spin)

Lock an existing Spin entry.

Parameters
SpinHandle of Spin entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_unlock()

uint32_t STDCALL spin_unlock ( SPIN_HANDLE spin)

Unlock an existing Spin entry.

Parameters
SpinHandle of Spin entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_lock_irq()

uint32_t STDCALL spin_lock_irq ( SPIN_HANDLE spin)

Lock an existing Spin entry, disable IRQ and save the previous IRQ state.

Parameters
SpinHandle of Spin entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_unlock_irq()

uint32_t STDCALL spin_unlock_irq ( SPIN_HANDLE spin)

Unlock an existing Spin entry and restore the previous IRQ state.

Parameters
SpinHandle of Spin entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_lock_fiq()

uint32_t STDCALL spin_lock_fiq ( SPIN_HANDLE spin)

Lock an existing Spin entry, disable FIQ and save the previous FIQ state.

Parameters
SpinHandle of Spin entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_unlock_fiq()

uint32_t STDCALL spin_unlock_fiq ( SPIN_HANDLE spin)

Unlock an existing Spin entry and restore the previous FIQ state.

Parameters
SpinHandle of Spin entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_lock_irq_fiq()

uint32_t STDCALL spin_lock_irq_fiq ( SPIN_HANDLE spin)

Lock an existing Spin entry, disable IRQ and FIQ and save the previous IRQ and FIQ state.

Parameters
SpinHandle of Spin entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_unlock_irq_fiq()

uint32_t STDCALL spin_unlock_irq_fiq ( SPIN_HANDLE spin)

Unlock an existing Spin entry and restore the previous IRQ and FIQ state.

Parameters
SpinHandle of Spin entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ spin_lock_preempt()

uint32_t STDCALL spin_lock_preempt ( SPIN_HANDLE spin)

Lock an existing Spin entry, disable IRQ or IRQ/FIQ and save the previous IRQ or IRQ/FIQ state.

Parameters
SpinHandle of Spin entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
This is a convenience wrapper which determines the appropriate SpinLock call to disable preemption

◆ spin_unlock_preempt()

uint32_t STDCALL spin_unlock_preempt ( SPIN_HANDLE spin)

Unlock an existing Spin entry and restore the previous IRQ or IRQ/FIQ state.

Parameters
SpinHandle of Spin entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
This is a convenience wrapper which determines the appropriate SpinUnlock call to enable preemption

◆ spin_check_irq()

BOOL STDCALL spin_check_irq ( SPIN_HANDLE spin)

Check the mask that stores the previous IRQ state to determine if IRQ is enabled.

Parameters
SpinHandle of Spin entry to check
Returns
True if the mask would enable IRQ on restore, False if it would not
Note
The Spin entry must be locked by the current thread

◆ spin_check_fiq()

BOOL STDCALL spin_check_fiq ( SPIN_HANDLE spin)

Check the mask that stores the previous FIQ state to determine if FIQ is enabled.

Parameters
SpinHandle of Spin entry to check
Returns
True if the mask would enable FIQ on restore, False if it would not
Note
The Spin entry must be locked by the current thread

◆ spin_exchange_irq()

uint32_t STDCALL spin_exchange_irq ( SPIN_HANDLE spin1,
SPIN_HANDLE spin2 )

Exchange the previous IRQ state between two Spin entries.

Parameters
Spin1Handle of first Spin entry
Spin2Handle of second Spin entry
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Both Spin entries must be locked by the current thread

◆ spin_exchange_fiq()

uint32_t STDCALL spin_exchange_fiq ( SPIN_HANDLE spin1,
SPIN_HANDLE spin2 )

Exchange the previous FIQ state between two Spin entries.

Parameters
Spin1Handle of first Spin entry
Spin2Handle of second Spin entry
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Both Spin entries must be locked by the current thread

◆ mutex_create()

MUTEX_HANDLE STDCALL mutex_create ( void )

Create and insert a new Mutex entry.

Mutex Functions

Returns
Handle of new Mutex entry or INVALID_HANDLE_VALUE if entry could not be created

◆ mutex_create_ex()

MUTEX_HANDLE STDCALL mutex_create_ex ( BOOL initialowner,
uint32_t spincount,
uint32_t flags )

Create and insert a new Mutex entry.

Parameters
InitialOwnerIf true set the state of the mutex to locked and the owner to the current thread
SpinCountThe number of times the mutex will spin before yielding (Always 0 if CPU count equals 1)
FlagsThe flags for the Mutex entry (eg MUTEX_FLAG_RECURSIVE)
Returns
Handle of new Mutex entry or INVALID_HANDLE_VALUE if entry could not be created

◆ mutex_destroy()

uint32_t STDCALL mutex_destroy ( MUTEX_HANDLE mutex)

Destroy and remove an existing Mutex entry.

Parameters
MutexHandle of Mutex entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mutex_flags()

uint32_t STDCALL mutex_flags ( MUTEX_HANDLE mutex)

Get the current flags of an existing Mutex entry.

Parameters
MutexHandle of Mutex entry to get flags for
Returns
Current flags or INVALID_HANDLE_VALUE on error

◆ mutex_count()

uint32_t STDCALL mutex_count ( MUTEX_HANDLE mutex)

Get the current lock count of an existing Mutex entry.

Parameters
MutexMutex to get count for
Returns
Current lock count or INVALID_HANDLE_VALUE on error
Note
Count is only valid if Flags includes MUTEX_FLAG_RECURSIVE

◆ mutex_owner()

THREAD_HANDLE STDCALL mutex_owner ( MUTEX_HANDLE mutex)

Get the current owner of an existing Mutex entry.

Parameters
MutexHandle of Mutex entry to get owner for
Returns
Handle of owning thread or INVALID_HANDLE_VALUE if not currently owned

◆ mutex_lock()

uint32_t STDCALL mutex_lock ( MUTEX_HANDLE mutex)

Lock an existing Mutex entry.

Parameters
MutexHandle of Mutex entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mutex_unlock()

uint32_t STDCALL mutex_unlock ( MUTEX_HANDLE mutex)

Unlock an existing Mutex entry.

Parameters
MutexHandle of Mutex entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mutex_try_lock()

uint32_t STDCALL mutex_try_lock ( MUTEX_HANDLE mutex)

Try to lock an existing Mutex entry.

If the Mutex is not locked then lock it and mark the owner as the current thread

If the Mutex is already locked then return immediately with an error and do not wait for it to be unlocked

Parameters
MutexMutex to try to lock
Returns
ERROR_SUCCESS if completed, ERROR_LOCKED if already locked or another error code on failure

◆ critical_section_create()

CRITICAL_SECTION_HANDLE STDCALL critical_section_create ( void )

Create and insert a new CriticalSection entry.

Critical Section Functions

Returns
Handle of new CriticalSection entry or INVALID_HANDLE_VALUE if entry could not be created

◆ critical_section_create_ex()

CRITICAL_SECTION_HANDLE STDCALL critical_section_create_ex ( BOOL initialowner,
uint32_t spincount )

Create and insert a new CriticalSection entry.

Parameters
InitialOwnerIf true set the state of the criticalsection to locked and the owner to the current thread
SpinCountThe number of times the criticalsection will spin before waiting (Always 0 if CPU count equals 1)
Returns
Handle of new CriticalSection entry or INVALID_HANDLE_VALUE if entry could not be created

◆ critical_section_destroy()

uint32_t STDCALL critical_section_destroy ( CRITICAL_SECTION_HANDLE criticalsection)

Destroy and remove an existing CriticalSection entry.

Parameters
CriticalSectionHandle of CriticalSection entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ critical_section_count()

uint32_t STDCALL critical_section_count ( CRITICAL_SECTION_HANDLE criticalsection)

Get the current lock count of an existing CriticalSection entry.

Parameters
CriticalSectionCriticalSection to get count for
Returns
Current lock count or INVALID_HANDLE_VALUE on error

◆ critical_section_owner()

THREAD_HANDLE STDCALL critical_section_owner ( CRITICAL_SECTION_HANDLE criticalsection)

Get the current owner of an existing CriticalSection entry.

Parameters
CriticalSectionCriticalSection to get owner for
Returns
Handle of owning thread or INVALID_HANDLE_VALUE if not currently owned

◆ critical_section_set_spin_count()

uint32_t STDCALL critical_section_set_spin_count ( CRITICAL_SECTION_HANDLE criticalsection,
uint32_t spincount )

Set the spin count of an existing CriticalSection entry.

Parameters
CriticalSectionCriticalSection to set spin count for
SpinCountThe spin count value to set
Returns
Current spin count or INVALID_HANDLE_VALUE on error

◆ critical_section_lock()

uint32_t STDCALL critical_section_lock ( CRITICAL_SECTION_HANDLE criticalsection)

Lock an existing CriticalSection entry.

If the CriticalSection is not locked then lock it, set the count to one and mark the owner as the current thread

If the CriticalSection is already locked by the current thread then increment the count and return immediately

If the CriticalSection is already locked by another thread then wait until it is unlocked

Parameters
CriticalSectionCriticalSection to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ critical_section_lock_ex()

uint32_t STDCALL critical_section_lock_ex ( CRITICAL_SECTION_HANDLE criticalsection,
uint32_t timeout )

Lock an existing CriticalSection entry.

If the CriticalSection is not locked then lock it, set the count to one and mark the owner as the current thread

If the CriticalSection is already locked by the current thread then increment the count and return immediately

If the CriticalSection is already locked by another thread then wait until it is unlocked

Parameters
CriticalSectionCriticalSection to lock
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ critical_section_unlock()

uint32_t STDCALL critical_section_unlock ( CRITICAL_SECTION_HANDLE criticalsection)

Unlock an existing CriticalSection entry.

If the CriticalSection is locked by the current thread then decrement the count

If the count is greater than zero then return immediately

If the count reaches zero then unlock the CriticalSection and release the first thread waiting for it to be unlocked

If the CriticalSection is locked by another thread then return an error

If the CriticalSection is not locked then return an error

Parameters
CriticalSectionCriticalSection to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ critical_section_try_lock()

uint32_t STDCALL critical_section_try_lock ( CRITICAL_SECTION_HANDLE criticalsection)

Try to lock an existing CriticalSection entry.

If the CriticalSection is not locked then lock it, set the count to one and mark the owner as the current thread

If the CriticalSection is already locked by the current thread then increment the count and return immediately

If the CriticalSection is already locked by another thread then return immediately with an error and do not wait for it to be unlocked

Parameters
CriticalSectionCriticalSection to try to lock
Returns
ERROR_SUCCESS if completed, ERROR_LOCKED if locked by another thread or another error code on failure

◆ semaphore_create()

SEMAPHORE_HANDLE STDCALL semaphore_create ( uint32_t count)

Create and insert a new Semaphore entry.

Semaphore Functions

Parameters
CountThe initial count of the Semaphore (Must be greater than or equal to zero)
Returns
Handle of new Semaphore entry or INVALID_HANDLE_VALUE if entry could not be created

◆ semaphore_create_ex()

SEMAPHORE_HANDLE STDCALL semaphore_create_ex ( uint32_t count,
uint32_t maximum,
uint32_t flags )

Create and insert a new Semaphore entry.

Parameters
CountThe initial count of the Semaphore (Must be greater than or equal to zero)
MaximumThe maximum count of the Semaphore (Must be greater than one)
FlagsThe flags for the Semaphore entry (eg SEMAPHORE_FLAG_IRQ)
Returns
Handle of new Semaphore entry or INVALID_HANDLE_VALUE if entry could not be created

◆ semaphore_destroy()

uint32_t STDCALL semaphore_destroy ( SEMAPHORE_HANDLE semaphore)

Destroy and remove an existing Semaphore entry.

Parameters
SemaphoreHandle of Semaphore entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ semaphore_count()

uint32_t STDCALL semaphore_count ( SEMAPHORE_HANDLE semaphore)

Get the current count of an existing Semaphore entry.

Parameters
SemaphoreSemaphore to get count for
Returns
Current count or INVALID_HANDLE_VALUE on error

◆ semaphore_wait()

uint32_t STDCALL semaphore_wait ( SEMAPHORE_HANDLE semaphore)

Wait on an existing Semaphore entry.

If the Semaphore count is greater than zero it will be decremented and this function will return immediately

If the Semaphore count is zero the current thread will be put on a wait queue until the Semaphore is signalled by another thread calling SemaphoreSignal() or SemaphoreSignalEx()

Parameters
SemaphoreSemaphore to wait on
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ semaphore_wait_ex()

uint32_t STDCALL semaphore_wait_ex ( SEMAPHORE_HANDLE semaphore,
uint32_t timeout )

Wait on an existing Semaphore entry.

If the Semaphore count is greater than zero it will be decremented and this function will return immediately

If the Semaphore count is zero the current thread will be put on a wait queue until the Semaphore is signalled by another thread calling SemaphoreSignal() or SemaphoreSignalEx()

Parameters
SemaphoreSemaphore to wait on
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ semaphore_signal()

uint32_t STDCALL semaphore_signal ( SEMAPHORE_HANDLE semaphore)

Signal an existing Semaphore entry.

If any threads are waiting on the Semaphore then one thread will be woken up and placed on the ready queue

If no threads are waiting then the Semaphore count will be incremented by one

Parameters
SemaphoreSemaphore to signal
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ semaphore_signal_ex()

uint32_t STDCALL semaphore_signal_ex ( SEMAPHORE_HANDLE semaphore,
uint32_t count,
uint32_t * previous )

Signal an existing Semaphore entry one or more times.

If any threads are waiting on the Semaphore then one thread will be woken up and placed on the ready queue for each iteration of the count passed

If no threads are waiting then the Semaphore count will be incremented once for each iteration of the count passed

Parameters
SemaphoreSemaphore to signal
CountThe number is times to signal the Semaphore, must be greater than zero
PreviousA pointer to a value that receives the previous count of the Semaphore Can be nil if the previous count is not required
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_create()

SYNCHRONIZER_HANDLE STDCALL synchronizer_create ( void )

Create and insert a new Synchronizer entry.

Synchronizer Functions

Returns
Handle of new Synchronizer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ synchronizer_create_ex()

SYNCHRONIZER_HANDLE STDCALL synchronizer_create_ex ( BOOL initialreader,
BOOL initialwriter )

Create and insert a new Synchronizer entry.

Parameters
InitialReaderIf true set the state of the synchronizer to locked and the reader count to 1
InitialWriterIf true set the state of the synchronizer to locked and the writer owner to the current thread
Returns
Handle of new Synchronizer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ synchronizer_destroy()

uint32_t STDCALL synchronizer_destroy ( SYNCHRONIZER_HANDLE synchronizer)

Destroy and remove an existing Synchronizer entry.

Parameters
SynchronizerHandle of Synchronizer entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_reader_count()

uint32_t STDCALL synchronizer_reader_count ( SYNCHRONIZER_HANDLE synchronizer)

Get the current reader count of an existing Synchronizer entry.

Parameters
SynchronizerSynchronizer to get count for
Returns
Current reader count or INVALID_HANDLE_VALUE on error

◆ synchronizer_reader_last()

THREAD_HANDLE STDCALL synchronizer_reader_last ( SYNCHRONIZER_HANDLE synchronizer)

Get the last reader thread of an existing Synchronizer entry.

Parameters
SynchronizerSynchronizer to last reader for
Returns
Last reader thread or INVALID_HANDLE_VALUE on error

◆ synchronizer_reader_lock()

uint32_t STDCALL synchronizer_reader_lock ( SYNCHRONIZER_HANDLE synchronizer)

Lock an existing Synchronizer entry for reading.

If the Synchronizer is not locked then lock it and set the reader count to one

If the Synchronizer is already locked for reading then increment the reader count and return immediately

If the Synchronizer is already locked for writing then wait until it is unlocked

Parameters
SynchronizerSynchronizer to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_reader_lock_ex()

uint32_t STDCALL synchronizer_reader_lock_ex ( SYNCHRONIZER_HANDLE synchronizer,
uint32_t timeout )

Lock an existing Synchronizer entry for reading.

If the Synchronizer is not locked then lock it and set the reader count to one

If the Synchronizer is already locked for reading then increment the reader count and return immediately

If the Synchronizer is already locked for writing then wait until it is unlocked

Parameters
SynchronizerSynchronizer to lock
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ synchronizer_reader_unlock()

uint32_t STDCALL synchronizer_reader_unlock ( SYNCHRONIZER_HANDLE synchronizer)

Unlock an existing Synchronizer entry.

If the Synchronizer is locked for reading then decrement the count

If the count is greater than zero then return immediately

If the count reaches zero then unlock the Synchronizer and release the first writer thread waiting for it to be unlocked

If the Synchronizer is locked for writing then return an error

If the Synchronizer is not locked then return an error

Parameters
SynchronizerSynchronizer to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_reader_convert()

uint32_t STDCALL synchronizer_reader_convert ( SYNCHRONIZER_HANDLE synchronizer)

Convert a reader lock on an existing Synchronizer entry to a writer lock.

If the Synchronizer is locked for reading then decrement the count

If the count is greater than zero then wait to acquire the writer lock

If the count reaches zero then convert to writer lock with the current thread as the owner

If the Synchronizer is locked for writing then return an error

If the Synchronizer is not locked then return an error

Parameters
SynchronizerSynchronizer to convert
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Since reader locks are recursive but do not maintain reader thread ownership, caller must ensure that one and only one reader lock is held by the current thread

◆ synchronizer_reader_convert_ex()

uint32_t STDCALL synchronizer_reader_convert_ex ( SYNCHRONIZER_HANDLE synchronizer,
uint32_t timeout )

Convert a reader lock on an existing Synchronizer entry to a writer lock.

If the Synchronizer is locked for reading then decrement the count

If the count is greater than zero then wait to acquire the writer lock

If the count reaches zero then convert to writer lock with the current thread as the owner

If the Synchronizer is locked for writing then return an error

If the Synchronizer is not locked then return an error

Parameters
SynchronizerSynchronizer to convert
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Since reader locks are recursive but do not maintain reader thread ownership, caller must ensure that one and only one reader lock is held by the current thread Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ synchronizer_writer_count()

uint32_t STDCALL synchronizer_writer_count ( SYNCHRONIZER_HANDLE synchronizer)

Get the current writer count of an existing Synchronizer entry.

Parameters
SynchronizerSynchronizer to get count for
Returns
Current writer count or INVALID_HANDLE_VALUE on error

◆ synchronizer_writer_owner()

THREAD_HANDLE STDCALL synchronizer_writer_owner ( SYNCHRONIZER_HANDLE synchronizer)

Get the current writer owner of an existing Synchronizer entry.

Parameters
SynchronizerSynchronizer to get owner for
Returns
Handle of owning thread or INVALID_HANDLE_VALUE if not currently owned

◆ synchronizer_writer_lock()

uint32_t STDCALL synchronizer_writer_lock ( SYNCHRONIZER_HANDLE synchronizer)

Lock an existing Synchronizer entry for writing.

If the Synchronizer is not locked then lock it, set the writer count to one and mark the owner as the current thread

If the Synchronizer is already locked by the current thread then increment the writer count and return immediately

If the Synchronizer is already locked for reading then wait until it is unlocked

Parameters
SynchronizerSynchronizer to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_writer_lock_ex()

uint32_t STDCALL synchronizer_writer_lock_ex ( SYNCHRONIZER_HANDLE synchronizer,
uint32_t timeout )

Lock an existing Synchronizer entry for writing.

If the Synchronizer is not locked then lock it, set the writer count to one and mark the owner as the current thread

If the Synchronizer is already locked by the current thread then increment the writer count and return immediately

If the Synchronizer is already locked for reading then wait until it is unlocked

Parameters
SynchronizerSynchronizer to lock
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ synchronizer_writer_unlock()

uint32_t STDCALL synchronizer_writer_unlock ( SYNCHRONIZER_HANDLE synchronizer)

Unlock an existing Synchronizer entry.

If the Synchronizer is locked for writing by the current thread then decrement the count

If the count is greater than zero then return immediately

If the count reaches zero then unlock the Synchronizer and release all reader threads waiting for it to be unlocked or the first writer thread waiting for it to be unlocked

If the Synchronizer is locked for reading then return an error

If the Synchronizer is locked for writing by another thread then return an error

If the Synchronizer is not locked then return an error

Parameters
SynchronizerSynchronizer to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ synchronizer_writer_convert()

uint32_t STDCALL synchronizer_writer_convert ( SYNCHRONIZER_HANDLE synchronizer)

Convert a writer lock on an existing Synchronizer entry to a reader lock.

If the Synchronizer is locked for writing by the current thread and the count is one then decrement the count

If the count is greater than one then return an error

If the count reaches zero then convert to reader lock and release all waiting reader threads

If the Synchronizer is locked for reading then return an error

If the Synchronizer is not locked then return an error

Parameters
SynchronizerSynchronizer to convert
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Since writer locks are recursive, caller must ensure that one and only one writer lock is held by the current thread

◆ condition_create()

CONDITION_HANDLE STDCALL condition_create ( void )

Create and insert a new Condition entry.

Condition Functions

Returns
Handle of new Condition entry or INVALID_HANDLE_VALUE if entry could not be created

◆ condition_destroy()

uint32_t STDCALL condition_destroy ( CONDITION_HANDLE condition)

Destroy and remove an existing Condition entry.

Parameters
ConditionHandle of Condition entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ condition_wait()

uint32_t STDCALL condition_wait ( CONDITION_HANDLE condition,
uint32_t timeout )

Wait on an existing Condition.

Parameters
ConditionCondition to wait on
TimeoutTime in milliseconds to wait to be woken 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ condition_wait_mutex()

uint32_t STDCALL condition_wait_mutex ( CONDITION_HANDLE condition,
MUTEX_HANDLE mutex,
uint32_t timeout )

Release a Mutex and Wait on an existing Condition in an atomic operation.

Parameters
ConditionCondition to wait on
MutexMutex to release
TimeoutTime in milliseconds to wait to be woken 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure. Before returning (with either success or failure) the thread will reacquire the Mutex
Note
Caller must be the owner of the Mutex with a count of one on entry to this function Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ condition_wait_synchronizer()

uint32_t STDCALL condition_wait_synchronizer ( CONDITION_HANDLE condition,
SYNCHRONIZER_HANDLE synchronizer,
uint32_t flags,
uint32_t timeout )

Release a Synchronizer and Wait on an existing Condition in an atomic operation.

Parameters
ConditionCondition to wait on
SynchronizerSynchronizer to release
FlagsFlags to indicate reader or writer lock for the Synchronizer (eg CONDITION_LOCK_FLAG_WRITER)
TimeoutTime in milliseconds to wait to be woken 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure. Before returning (with either success or failure) the thread will reacquire the Synchronizer for either reading or writing depending on the flags value
Note
Caller must be the owner of the Synchronizer with a count of one on entry to this function and the ownership must match the flags value provided Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ condition_wait_critical_section()

uint32_t STDCALL condition_wait_critical_section ( CONDITION_HANDLE condition,
CRITICAL_SECTION_HANDLE criticalsection,
uint32_t timeout )

Release a Critical Section and Wait on an existing Condition in an atomic operation.

Parameters
ConditionCondition to wait on
CriticalSectionCritical Section to release
TimeoutTime in milliseconds to wait to be woken 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure. Before returning (with either success or failure) the thread will reacquire the Synchronizer for either reading or writing depending on the flags value
Note
Caller must be the owner of the Critical Section with a count of one on entry to this function Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ condition_wake()

uint32_t STDCALL condition_wake ( CONDITION_HANDLE condition)

Wake one thread waiting on an existing Condition.

Parameters
ConditionCondition to wake
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ condition_wake_all()

uint32_t STDCALL condition_wake_all ( CONDITION_HANDLE condition)

Wake all threads waiting on an existing Condition.

Parameters
ConditionCondition to wake
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ completion_create()

COMPLETION_HANDLE STDCALL completion_create ( uint32_t flags)

Create and insert a new Completion entry.

Completion Functions

Parameters
FlagsThe flags for the Completion entry (eg COMPLETION_FLAG_IRQ)
Returns
Handle of new Completion entry or INVALID_HANDLE_VALUE if entry could not be created

◆ completion_destroy()

uint32_t STDCALL completion_destroy ( COMPLETION_HANDLE completion)

Destroy and remove an existing Completion entry.

Parameters
CompletionHandle of Completion entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ completion_state()

uint32_t STDCALL completion_state ( COMPLETION_HANDLE completion)

Get the current state of an existing Completion entry.

Parameters
CompletionCompletion to get the state for
Returns
Current state (eg COMPLETION_STATE_COMPLETE) or INVALID_HANDLE_VALUE on error

◆ completion_wait()

uint32_t STDCALL completion_wait ( COMPLETION_HANDLE completion,
uint32_t timeout )

Wait on an existing Completion.

If the completion is set (complete) then return immediately with success

If the completion is not set then wait for it to be completed before returning

For counted completions, decrement the count if it is not 0 or -1 after testing if the completion is set

Parameters
CompletionCompletion to wait on
TimeoutTime in milliseconds to wait to be woken 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ completion_try_wait()

uint32_t STDCALL completion_try_wait ( COMPLETION_HANDLE completion)

Try an existing Completion to see if it is completed.

If the completion is not set (complete) then return immediately with an error and do not wait for it to be completed

Parameters
CompletionCompletion to try
Returns
ERROR_SUCCESS if completed, ERROR_NOT_READY if not completed or another error code on failure

◆ completion_reset()

uint32_t STDCALL completion_reset ( COMPLETION_HANDLE completion)

Reset (uncomplete) the state of an existing Completion entry.

If the completion is not set then return with no action

If the completion is set then change the state to not set

For counted completions, reset the counter to 0

Parameters
CompletionCompletion to reset the state for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ completion_complete()

uint32_t STDCALL completion_complete ( COMPLETION_HANDLE completion)

Set (complete) the state of an existing Completion entry.

If the completion is already set then return with no action

If the completion is not set then release one waiting thread (if any) and return

For counted completions, release one waiting thread, if there are no waiting threads increment the count if it is not -1 and return

Parameters
CompletionCompletion to set the state for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ completion_complete_all()

uint32_t STDCALL completion_complete_all ( COMPLETION_HANDLE completion)

Set (complete) the state of an existing Completion entry.

If the completion is already set then return with no action

If the completion is not set then release all waiting threads (if any) and return

For counted completions, set the count to -1, release all waiting threads (if any) and return

Parameters
CompletionCompletion to set the state for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ list_create()

LIST_HANDLE STDCALL list_create ( void )

Create and insert a new List entry.

List Functions

Returns
Handle of new List entry or INVALID_HANDLE_VALUE if entry could not be created

◆ list_create_ex()

LIST_HANDLE STDCALL list_create_ex ( uint32_t listtype,
uint32_t flags )

Create and insert a new List entry.

Parameters
ListTypeType of list to create (eg LIST_TYPE_WAIT_SEMAPHORE)
FlagsFlags for the new list (eg LIST_FLAG_IRQ)
Returns
Handle of new List entry or INVALID_HANDLE_VALUE if entry could not be created

◆ list_destroy()

uint32_t STDCALL list_destroy ( LIST_HANDLE list)

Destroy and remove an existing List entry.

Parameters
ListHandle of List entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_count()

uint32_t STDCALL list_count ( LIST_HANDLE list)

Get the current count from the supplied list.

Parameters
ListHandle of List entry to get from
Returns
List count on success or INVALID_HANDLE_VALUE on failure

◆ list_add_first()

uint32_t STDCALL list_add_first ( LIST_HANDLE list,
LIST_ELEMENT * element )

Add the supplied element as the first item in the List.

Parameters
ListHandle of List entry to add to
ElementThe list element to be added
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_add_last()

uint32_t STDCALL list_add_last ( LIST_HANDLE list,
LIST_ELEMENT * element )

Add the supplied element as the last item in the List.

Parameters
ListHandle of List entry to add to
ElementThe list element to be added
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_get_thread()

LIST_ELEMENT *STDCALL list_get_thread ( LIST_HANDLE list,
THREAD_HANDLE thread )

Find the supplied thread in the List and return its element.

Parameters
ListHandle of List entry to find from
ThreadThe thread handle to be found
Returns
List element on success, nil on failure or list empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_get_first()

LIST_ELEMENT *STDCALL list_get_first ( LIST_HANDLE list)

Get the first element from the List.

Parameters
ListHandle of List entry to get from
Returns
List element on success, nil on failure or list empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_get_first_ex()

LIST_ELEMENT *STDCALL list_get_first_ex ( LIST_HANDLE list,
BOOL remove )

Get the first element from the List.

Parameters
ListHandle of List entry to get from
RemoveIf true then remove the element from the list
Returns
List element on success, nil on failure or list empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_get_last()

LIST_ELEMENT *STDCALL list_get_last ( LIST_HANDLE list)

Get the last element from the List.

Parameters
ListHandle of List entry to get from
Returns
List element on success, nil on failure or list empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_get_last_ex()

LIST_ELEMENT *STDCALL list_get_last_ex ( LIST_HANDLE list,
BOOL remove )

Get the last element from the List.

Parameters
ListHandle of List entry to get from
RemoveIf true then remove the element from the list
Returns
List element on success, nil on failure or list empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_insert()

uint32_t STDCALL list_insert ( LIST_HANDLE list,
LIST_ELEMENT * previous,
LIST_ELEMENT * element )

Insert a new element in the List.

Parameters
ListHandle of List entry to insert into
PreviousThe element to insert the new element after
ElementThe list element to be inserted
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_remove()

uint32_t STDCALL list_remove ( LIST_HANDLE list,
LIST_ELEMENT * element )

Remove an element from the List.

Parameters
ListHandle of List entry to remove from
ElementThe list element to be removed
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_is_empty()

BOOL STDCALL list_is_empty ( LIST_HANDLE list)

Check if the supplied List is empty.

Parameters
ListHandle of List entry to check
Returns
True if List is empty or does not exist, False if List is not empty
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_not_empty()

BOOL STDCALL list_not_empty ( LIST_HANDLE list)

Check if the supplied List is empty.

Parameters
ListHandle of List entry to check
Returns
True if List is not empty, False if List is empty or does not exist
Note
If list is part of a synchronisation object then caller must hold the lock on the object containing the list

◆ list_lock()

uint32_t STDCALL list_lock ( LIST_HANDLE list)

Lock the supplied List.

Parameters
ListHandle of List entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ list_unlock()

uint32_t STDCALL list_unlock ( LIST_HANDLE list)

Unlock the supplied List.

Parameters
ListHandle of List entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ queue_create()

QUEUE_HANDLE STDCALL queue_create ( void )

Create and insert a new Queue entry.

Queue Functions

Returns
Handle of new Queue entry or INVALID_HANDLE_VALUE if entry could not be created

◆ queue_create_ex()

QUEUE_HANDLE STDCALL queue_create_ex ( uint32_t queuetype,
uint32_t flags )

Create and insert a new Queue entry.

Parameters
QueueTypeType of queue to create (eg QUEUE_TYPE_SCHEDULE_SLEEP)
FlagsFlags for the new queue (eg QUEUE_FLAG_DESCENDING)
Returns
Handle of new Queue entry or INVALID_HANDLE_VALUE if entry could not be created

◆ queue_destroy()

uint32_t STDCALL queue_destroy ( QUEUE_HANDLE queue)

Destroy and remove an existing Queue entry.

Parameters
QueueHandle of Queue entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ queue_count()

uint32_t STDCALL queue_count ( QUEUE_HANDLE queue)

Get the current count from the supplied queue.

Parameters
ListHandle of Queue entry to get from
Returns
Queue count on success or INVALID_HANDLE_VALUE on failure

◆ queue_enqueue()

uint32_t STDCALL queue_enqueue ( QUEUE_HANDLE queue,
THREAD_HANDLE thread )

Add the supplied thread as the last item in the Queue.

Parameters
QueueHandle of Queue entry to add to
ThreadHandle of the Thread to enqueue
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If queue is a scheduler queue then caller must hold the lock on the thread

◆ queue_dequeue()

THREAD_HANDLE STDCALL queue_dequeue ( QUEUE_HANDLE queue)

Get and remove the first thread from the Queue.

Parameters
QueueHandle of Queue entry to get from
Returns
Handle of dequeued Thread or INVALID_HANDLE_VALUE on failure

◆ queue_first_key()

int STDCALL queue_first_key ( QUEUE_HANDLE queue)

Get the first Key value from the Queue.

Parameters
QueueHandle of Queue entry to get from
Returns
First Key value from queue or QUEUE_KEY_NONE on failure

◆ queue_last_key()

int STDCALL queue_last_key ( QUEUE_HANDLE queue)

Get the last Key value from the Queue.

Parameters
QueueHandle of Queue entry to get from
Returns
Last Key value from queue or QUEUE_KEY_NONE on failure

◆ queue_insert_key()

uint32_t STDCALL queue_insert_key ( QUEUE_HANDLE queue,
THREAD_HANDLE thread,
int key )

Insert the supplied thread in the Queue ordered based on Key and the flags of the Queue.

Parameters
QueueHandle of Queue entry to insert into
ThreadHandle of thread to be inserted
KeyThe key to order the insertion on
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If queue is a scheduler queue then caller must hold the lock on the thread

◆ queue_delete_key()

uint32_t STDCALL queue_delete_key ( QUEUE_HANDLE queue,
THREAD_HANDLE thread )

Delete the supplied thread from the Queue based on the flags of the Queue.

Parameters
QueueHandle of Queue entry to delete from
ThreadHandle of thread to be deleted
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
If queue is a scheduler queue then caller must hold the lock on the thread

◆ queue_increment_key()

int STDCALL queue_increment_key ( QUEUE_HANDLE queue)

Increment the first Key value in the Queue.

Parameters
QueueHandle of Queue entry to increment in
Returns
First Key value in queue after increment or QUEUE_KEY_NONE on failure

◆ queue_decrement_key()

int STDCALL queue_decrement_key ( QUEUE_HANDLE queue)

Decrement the first Key value in the Queue.

Parameters
QueueHandle of Queue entry to decrement in
Returns
First Key value in queue after decrement or QUEUE_KEY_NONE on failure

◆ queue_is_empty()

BOOL STDCALL queue_is_empty ( QUEUE_HANDLE queue)

Check if the supplied Queue is empty.

Parameters
QueueHandle of Queue entry to check
Returns
True if Queue is empty or does not exist, False if Queue is not empty

◆ queue_not_empty()

BOOL STDCALL queue_not_empty ( QUEUE_HANDLE queue)

Check if the supplied Queue is not empty.

Parameters
QueueHandle of Queue entry to check
Returns
True if Queue is not empty, False if Queue is empty or does not exist

◆ queue_lock()

uint32_t STDCALL queue_lock ( QUEUE_HANDLE queue)

Lock the supplied Queue.

Parameters
QueueHandle of Queue entry to lock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ queue_unlock()

uint32_t STDCALL queue_unlock ( QUEUE_HANDLE queue)

Unlock the supplied Queue.

Parameters
QueueHandle of Queue entry to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_create()

THREAD_HANDLE STDCALL thread_create ( thread_start_proc startproc,
uint32_t stacksize,
uint32_t priority,
const char * name,
void * parameter )

Create and insert a new Thread entry.

Thread Functions

The new thread will be created suspended so it will not start running until it is scheduled with either ThreadReady or ThreadResume

Parameters
StartProcProcedure address where the thread will start running
StackSizeStack size in bytes
PriorityThread priority (eg THREAD_PRIORITY_NORMAL)
NameName of the thread
ParameterParameter passed to StartProc of new thread
Returns
Handle of new thread or INVALID_HANDLE_VALUE if a new thread could not be created
Note
Calls ThreadCreateEx with: Affinity = SCHEDULER_CPU_MASK (Run on any available CPU) CPU = SchedulerThreadNext (Assign to next CPU in round robin)
Parameters
WARNINGThreadCreate and ThreadCreateEx are only used internally by SysBeginThread and SysBeginThreadEx
      These functions do not handle setting up certain RTL functionality such as thread variables,
      exceptions and standard input/output handles.

      If you need to create a standard thread use either BeginThread (or BeginThreadEx) or use the
      TThread class and its descendants. Only use ThreadCreate and ThreadCreateEx if you need to modify
      the thread creation behaviour and understand that you also need to handle the additional RTL setup

◆ thread_create_ex()

THREAD_HANDLE STDCALL thread_create_ex ( thread_start_proc startproc,
uint32_t stacksize,
uint32_t priority,
uint32_t affinity,
uint32_t cpu,
const char * name,
void * parameter )

Create and insert a new Thread entry.

The new thread will be created suspended so it will not start running until it is scheduled with either ThreadReady or ThreadResume

Parameters
StartProcProcedure address where the thread will start running
StackSizeStack size in bytes
PriorityThread priority (eg THREAD_PRIORITY_NORMAL)
AffinityThread affinity (eg CPU_AFFINITY_ALL)
CPUThe CPU to assign new thread to (eg CPU_ID_0)
NameName of the thread
ParameterParameter passed to StartProc of new thread
Returns
Handle of new thread or INVALID_HANDLE_VALUE if a new thread could not be created
Parameters
WARNINGThreadCreate and ThreadCreateEx are only used internally by SysBeginThread and SysBeginThreadEx
      These functions do not handle setting up certain RTL functionality such as thread variables,
      exceptions and standard input/output handles.

      If you need to create a standard thread use either BeginThread (or BeginThreadEx) or use the
      TThread class or its descendants. Only use ThreadCreate and ThreadCreateEx if you need to modify
      the thread creation behaviour and understand that you also need to handle the additional RTL setup

◆ thread_destroy()

uint32_t STDCALL thread_destroy ( THREAD_HANDLE thread)

Destroy and remove an existing Thread entry.

Parameters
ThreadHandle of thread to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_current()

THREAD_HANDLE STDCALL thread_get_current ( void )

Get the Handle of currently executing thread.

Returns
Thread handle of the currently running thread

◆ thread_set_current()

uint32_t STDCALL thread_set_current ( THREAD_HANDLE thread)

Set the Handle of currently executing thread.

Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Must not be called except during initialization

◆ thread_get_name()

uint32_t STDCALL thread_get_name ( THREAD_HANDLE thread,
char * name,
uint32_t len )

Get the name of a Thread.

Parameters
ThreadHandle of thread to get
Returns
Name of thread or empty string on failure

◆ thread_set_name()

uint32_t STDCALL thread_set_name ( THREAD_HANDLE thread,
const char * name )

Set the name of a Thread.

Parameters
ThreadHandle of thread to set
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_cpu()

uint32_t STDCALL thread_get_cpu ( THREAD_HANDLE thread)

Get the current CPU of a thread (eg CPU_ID_0).

Parameters
ThreadHandle of thread to get
Returns
CPU of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_set_cpu()

uint32_t STDCALL thread_set_cpu ( THREAD_HANDLE thread,
uint32_t cpu )

Set the current CPU of a thread (eg CPU_ID_0).

The new CPU will not take affect until the thread is next rescheduled

Parameters
ThreadHandle of thread to set
CPUNew thread CPU (eg CPU_ID_0)
Returns
Previous CPU of thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_state()

uint32_t STDCALL thread_get_state ( THREAD_HANDLE thread)

Get the current state of a thread (eg THREAD_STATE_SUSPENDED).

Parameters
ThreadHandle of thread to get
Returns
State of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_flags()

uint32_t STDCALL thread_get_flags ( THREAD_HANDLE thread)

Get the current flags of a thread.

Parameters
ThreadHandle of thread to get
Returns
Flags of the thread (eg THREAD_FLAG_PERSIST) or INVALID_HANDLE_VALUE on failure

◆ thread_set_flags()

uint32_t STDCALL thread_set_flags ( THREAD_HANDLE thread,
uint32_t flags )

Set the current flags of a thread.

Parameters
ThreadHandle of thread to set
FlagsFlags to set (eg THREAD_FLAG_PERSIST)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_add_flags()

uint32_t STDCALL thread_add_flags ( THREAD_HANDLE thread,
uint32_t flags )

Add flags to the current flags of a thread.

Parameters
ThreadHandle of thread to add flags for
FlagsFlags to add (eg THREAD_FLAG_PERSIST)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_remove_flags()

uint32_t STDCALL thread_remove_flags ( THREAD_HANDLE thread,
uint32_t flags )

Remove flags from the current flags of a thread.

Parameters
ThreadHandle of thread to remove flags from
FlagsFlags to remove (eg THREAD_FLAG_PERSIST)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_locale()

LCID STDCALL thread_get_locale ( THREAD_HANDLE thread)

Get the current locale of a thread.

Parameters
ThreadHandle of thread to get
Returns
Locale of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_set_locale()

uint32_t STDCALL thread_set_locale ( THREAD_HANDLE thread,
LCID locale )

Set the locale of a thread.

Parameters
ThreadHandle of thread to set
LocaleLocale id to set
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_times()

uint32_t STDCALL thread_get_times ( THREAD_HANDLE thread,
int64_t * createtime,
int64_t * exittime,
int64_t * kerneltime )

Get the current times of a thread.

Parameters
ThreadHandle of thread to get
CreateTimeBuffer to receive the CreateTime value
ExitTimeBuffer to receive the ExitTime value
KernelTimeBuffer to receive the KernelTime value
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_switch_count()

uint32_t STDCALL thread_get_switch_count ( THREAD_HANDLE thread,
int64_t * switchcount )

Get the current context switch count of a thread (How many times the thread has been scheduled).

Parameters
ThreadHandle of thread to get
SwitchCountBuffer to receive the SwitchCount value
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_stack_free()

uint32_t STDCALL thread_get_stack_free ( void )

Get the free stack size of the current thread.

Returns
Free stack size of the current thread or 0 on error
Note
No lock required as only ever called by the thread itself

◆ thread_get_stack_size()

uint32_t STDCALL thread_get_stack_size ( THREAD_HANDLE thread)

Get the current stack size of a thread.

Parameters
ThreadHandle of thread to get
Returns
Stack size of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_stack_base()

size_t STDCALL thread_get_stack_base ( THREAD_HANDLE thread)

Get the current stack base of a thread.

Parameters
ThreadHandle of thread to get
Returns
Stack base of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_set_stack_base()

uint32_t STDCALL thread_set_stack_base ( THREAD_HANDLE thread,
size_t stackbase )

Set the current stack base of a thread.

Parameters
ThreadHandle of thread to set
StackBaseStack base to set
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Must not be called except during initialization

◆ thread_get_stack_pointer()

size_t STDCALL thread_get_stack_pointer ( THREAD_HANDLE thread)

Get the current stack pointer of a thread.

Parameters
ThreadHandle of thread to get
Returns
Stack pointer of the thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_exit_code()

uint32_t STDCALL thread_get_exit_code ( THREAD_HANDLE thread)

Get the exit code of a Thread.

Parameters
ThreadHandle of thread to get
Returns
Exit code of thread, STILL_ACTIVE if the thread has not terminated or INVALID_HANDLE_VALUE on failure

◆ thread_get_affinity()

uint32_t STDCALL thread_get_affinity ( THREAD_HANDLE thread)

Get the scheduling affinity of a Thread.

Parameters
ThreadHandle of thread to get
Returns
Affinity of thread or INVALID_HANDLE_VALUE on failure

◆ thread_set_affinity()

uint32_t STDCALL thread_set_affinity ( THREAD_HANDLE thread,
uint32_t affinity )

Set the scheduling affinity of a Thread.

The new affinity will not take affect until the thread is next rescheduled

Parameters
ThreadHandle of thread to set
AffinityNew thread affinity (eg CPU_AFFINITY_0)
Returns
Previous affinity of thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_priority()

uint32_t STDCALL thread_get_priority ( THREAD_HANDLE thread)

Get the scheduling priority of a Thread.

Parameters
ThreadHandle of thread to get
Returns
Priority of thread or INVALID_HANDLE_VALUE on failure

◆ thread_set_priority()

uint32_t STDCALL thread_set_priority ( THREAD_HANDLE thread,
uint32_t priority )

Set the scheduling priority of a Thread.

The new priority will not take affect until the thread is next rescheduled

Parameters
ThreadHandle of thread to set
PriorityNew thread priority (eg THREAD_PRIORITY_NORMAL)
Returns
Previous priority of thread or INVALID_HANDLE_VALUE on failure

◆ thread_get_last_error()

uint32_t STDCALL thread_get_last_error ( void )

Get the last error value for the current Thread.

Returns
Last Error of thread or ERROR_SUCCESS if no error
Note
No lock required as only ever called by the thread itself

◆ thread_set_last_error()

void STDCALL thread_set_last_error ( uint32_t lasterror)

Set the last error value for the current Thread.

Note
No lock required as only ever called by the thread itself

◆ thread_set_last_error_ex()

uint32_t STDCALL thread_set_last_error_ex ( uint32_t lasterror)

Set the last error value for the current Thread.

Returns
ERROR_SUCCESS if completed or another error code on failure
Note
No lock required as only ever called by the thread itself

◆ thread_get_wait_result()

uint32_t STDCALL thread_get_wait_result ( void )

Get the result of the last wait timeout for the current Thread.

Returns
Result of last wait timeout or ERROR_SUCCESS if no error
Note
No lock required as only ever called by the thread itself

◆ thread_get_receive_result()

uint32_t STDCALL thread_get_receive_result ( void )

Get the result of the last receive timeout for the current Thread.

Returns
Result of last receive timeout or ERROR_SUCCESS if no error
Note
No lock required as only ever called by the thread itself

◆ thread_get_tls_index()

uint32_t STDCALL thread_get_tls_index ( uint32_t tlsindex)

Get the current status of a TLS index in the TLS index table.

Parameters
TlsIndexThe TLS index to get the status for
Returns
THREAD_TLS_FREE if unused, THREAD_TLS_USED if in use or THREAD_TLS_INVALID on error
Note
No lock required as only ever reads from the table

◆ thread_alloc_tls_index()

uint32_t STDCALL thread_alloc_tls_index ( void )

Allocate a TLS index in the TLS index table.

Returns
Allocated TLS index or TLS_OUT_OF_INDEXES on failure

◆ thread_alloc_tls_index_ex()

uint32_t STDCALL thread_alloc_tls_index_ex ( uint32_t flags)

Allocate a TLS index in the TLS index table.

Parameters
FlagsThe flags to apply to the TLS index entries (eg THREAD_TLS_FLAG_FREE)
Returns
Allocated TLS index or TLS_OUT_OF_INDEXES on failure

◆ thread_release_tls_index()

uint32_t STDCALL thread_release_tls_index ( uint32_t tlsindex)

Deallocate a TLS index from the TLS index table.

Parameters
TlsIndexThe TLS index to deallocate
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_get_tls_value()

void *STDCALL thread_get_tls_value ( uint32_t tlsindex)

Get the pointer associated with the TLS index for the current thread.

Returns
Pointer for the specified TLS index or nil if not set or on error
Note
No lock required as only ever called by the thread itself

◆ thread_set_tls_value()

uint32_t STDCALL thread_set_tls_value ( uint32_t tlsindex,
void * tlsvalue )

Set the pointer associated with the TLS index for the current thread.

Parameters
TlsIndexThe TLS index to get the pointer for
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
No lock required as only ever called by the thread itself

◆ thread_get_tls_pointer()

void *STDCALL thread_get_tls_pointer ( THREAD_HANDLE thread)

Get the RTL TLS (Thread Local Storage) pointer of a Thread.

Parameters
ThreadHandle of thread to get
Returns
Pointer to the RTL TLS of thread or nil on failure

◆ thread_set_tls_pointer()

uint32_t STDCALL thread_set_tls_pointer ( THREAD_HANDLE thread,
void * tlspointer )

Set the RTL TLS (Thread Local Storage) pointer of a Thread.

Parameters
ThreadHandle of thread to set
TlsPointerPointer value to set (Can be nil to clear the pointer)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_ready()

uint32_t STDCALL thread_ready ( THREAD_HANDLE thread,
BOOL reschedule )

Place the supplied Thread on the ready queue.

Parameters
ThreadHandle of thread to make ready
RescheduleIf True then call SchedulerReschedule
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
When called by the scheduler, thread has already been removed from the sleep queue

◆ thread_timeout()

uint32_t STDCALL thread_timeout ( THREAD_HANDLE thread)

Place the supplied Thread on the ready queue after a timeout waiting on a resource.

Parameters
ThreadHandle of thread to make ready
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
When called by the scheduler, thread has already been removed from the timeout queue

◆ thread_wake()

uint32_t STDCALL thread_wake ( THREAD_HANDLE thread)

Remove a thread prematurely from the sleep or timeout queues.

Parameters
ThreadHandle of thread to remove
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
A thread that was sleeping will simply return early A thread that was waiting or receiving with a timeout will return with the error WAIT_TIMEOUT A thread that was waiting or receiving with INFINITE timeout will return with the error WAIT_ABANDONED

◆ thread_migrate()

uint32_t STDCALL thread_migrate ( THREAD_HANDLE thread,
uint32_t cpu )

Migrate a thread to a new CPU.

Parameters
ThreadHandle of thread to migrate
CPUNew CPU for the thread
Returns
Previous CPU of thread or INVALID_HANDLE_VALUE on failure

◆ thread_end()

void STDCALL thread_end ( uint32_t exitcode)

Terminate the current Thread.

Parameters
ExitCodeThe return code of the thread

◆ thread_halt()

uint32_t STDCALL thread_halt ( uint32_t exitcode)

Halt the current thread so it will never be rescheduled.

Normally only called due to an unhandled exception etc so that the thread is put to sleep permanently without being terminated

Parameters
ExitCodeThe return code of the thread
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_terminate()

uint32_t STDCALL thread_terminate ( THREAD_HANDLE thread,
uint32_t exitcode )

Terminate but do not destroy the supplied Thread.

The terminated thread is placed on the termination queue until any threads waiting on it have been released

Parameters
ThreadHandle of thread to terminate
ExitCodeThe return code of the thread
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Terminating a thread from another thread is not safe unless specific precautions are taken to prevent deadlocks It is normally safe for a thread to terminate itself as long as it releases any locks it is holding that may be required by other threads before terminating

◆ thread_yield()

uint32_t STDCALL thread_yield ( void )

Make the current thread yield the processor (Same as ThreadSleep(0)).

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_sleep()

uint32_t STDCALL thread_sleep ( uint32_t milliseconds)

Place the current thread on the sleep queue for a specified number of milliseconds.

Parameters
MillisecondsNumber of milliseconds to sleep
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_wait()

uint32_t STDCALL thread_wait ( LIST_HANDLE list,
SPIN_HANDLE lock,
uint32_t flags )

Put the current thread into a wait state on the supplied list.

Parameters
ListHandle of List entry to put thread into
LockHandle of Lock to release before going into wait state
FlagsFlag to indicate which unlock method to use
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the synchronisation object containing the list

◆ thread_wait_ex()

uint32_t STDCALL thread_wait_ex ( LIST_HANDLE list,
SPIN_HANDLE lock,
uint32_t flags,
uint32_t timeout )

Put the current thread into a wait state with timeout on the supplied list.

Parameters
ListHandle of List entry to put thread into
LockHandle of Lock to release before going into wait state
FlagsFlag to indicate which unlock method to use
TimeoutMilliseconds to wait before timeout (INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the synchronisation object containing the list Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ thread_release()

uint32_t STDCALL thread_release ( LIST_HANDLE list)

Release the first thread waiting on the supplied list.

Parameters
ListHandle of List entry to release thread from
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the synchronisation object containing the list

◆ thread_abandon()

uint32_t STDCALL thread_abandon ( LIST_HANDLE list)

Release the first thread waiting on the supplied list and return with WAIT_ABANDONED.

Parameters
ListHandle of List entry to release thread from
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the synchronisation object containing the list

◆ thread_wait_terminate()

uint32_t STDCALL thread_wait_terminate ( THREAD_HANDLE thread,
uint32_t timeout )

Make the current thread wait until the specified thread has terminated.

Parameters
ThreadHandle of the thread to wait on
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The wait can be abandoned by calling ThreadWake with the handle of the waiting thread Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ thread_suspend()

uint32_t STDCALL thread_suspend ( THREAD_HANDLE thread)

Suspend a thread, placing it in hibernation.

Parameters
ThreadHandle of thread to suspend
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Suspending a thread from another thread is not safe unless specific precautions are taken to prevent deadlocks It is normally safe for a thread to suspend itself as long as it releases any locks it is holding that may be required by other threads before suspending

◆ thread_resume()

uint32_t STDCALL thread_resume ( THREAD_HANDLE thread)

Resume a suspended thread, making it ready.

Parameters
ThreadHandle of thread to resume
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_wait_message()

uint32_t STDCALL thread_wait_message ( void )

Make the current thread wait until a message is received (indefinitely).

Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The received message is not removed from the message list

◆ thread_send_message()

uint32_t STDCALL thread_send_message ( THREAD_HANDLE thread,
THREAD_MESSAGE * message )

Send a message to another thread.

Parameters
ThreadHandle of thread to send to
MessageContents of message to send
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_receive_message()

uint32_t STDCALL thread_receive_message ( THREAD_MESSAGE * message)

Make the current thread wait to receive a message (indefinitely).

Parameters
MessageThe received message if successful, undefined on error
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ thread_receive_message_ex()

uint32_t STDCALL thread_receive_message_ex ( THREAD_MESSAGE * message,
uint32_t timeout,
BOOL remove )

Make the current thread wait to receive a message.

Parameters
MessageThe received message if successful, undefined on error
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
RemoveIf true then remove the received message from the message list
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then no Wait,Timeout = INFINITE then Wait forever

◆ thread_abandon_message()

uint32_t STDCALL thread_abandon_message ( THREAD_HANDLE thread)

Tell another thread to abandon waiting for a message.

Parameters
ThreadHandle of thread to abandon waiting
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The waiting thread will return with ERROR_WAIT_ABANDONED or ERROR_WAIT_TIMEOUT

◆ thread_lock()

uint32_t STDCALL thread_lock ( THREAD_HANDLE thread)

Lock a thread allowing access to internal structures such as the thread stack.

Parameters
ThreadHandle of thread to lock
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Locking a thread will also disable IRQ or FIQ depending on scheduler settings. The lock should only be held for the briefest time possible

◆ thread_unlock()

uint32_t STDCALL thread_unlock ( THREAD_HANDLE thread)

Unlok a thread that was locked by ThreadLock.

Parameters
ThreadHandle of thread to unlock
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Locking a thread will also disable IRQ or FIQ depending on scheduler settings. The lock should only be held for the briefest time possible

◆ scheduler_check()

uint32_t STDCALL scheduler_check ( uint32_t cpuid)

Check if the sleep queue is empty, if not then decrement the first key Then check if the timeout queue is empty, if not then decrement the first key.

Scheduler Functions

If either key reaches zero, return success to indicate there are threads to be woken or threads whose timeout has expired

Finally check if the termination queue is empty, if not then decrement the first key

Items will be removed from the termination queue by SchedulerReschedule

Parameters
CPUIDThe ID of the current CPU
Returns
ERROR_SUCCESS if either first key is zero, ERROR_NO_MORE_ITEMS if both queues are empty or another error code on failure
Note
Called by scheduler interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ scheduler_wakeup()

uint32_t STDCALL scheduler_wakeup ( uint32_t cpuid)

Remove all threads from the sleep queue that have no more time to sleep.

Threads will be placed back on the ready queue for rescheduling

Parameters
CPUIDThe ID of the current CPU
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Called by scheduler interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ scheduler_expire()

uint32_t STDCALL scheduler_expire ( uint32_t cpuid)

Remove all threads from the timeout queue that have no more time to wait.

Threads will be placed back on the ready queue for rescheduling but will return with an error indicating the timeout expired

Parameters
CPUIDThe ID of the current CPU
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Called by scheduler interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ scheduler_switch()

THREAD_HANDLE STDCALL scheduler_switch ( uint32_t cpuid,
THREAD_HANDLE thread )

Perform a preemptive thread switch operation under an interrupt handler.

The next thread to run will be selected based on remaining quantum of the current thread, ready threads at higher priority levels and scheduler priority quantum for fair scheduling of lower priority threads

Parameters
CPUIDThe ID of the current CPU
ThreadThe handle of the currently running thread (Before IRQ or FIQ occurred)
Returns
The handle of the current thread which may be the old thread or a new thread
Note
Called by scheduler interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ scheduler_select()

THREAD_HANDLE STDCALL scheduler_select ( uint32_t cpuid,
THREAD_HANDLE thread,
BOOL yield )

Select the next thread to be run based on state, yield, quantum and priority.

Parameters
CPUIDThe ID of the current CPU
ThreadThe handle of the currently running thread (Before IRQ or FIQ occurred or when Reschedule was called)
YieldTrue if the current thread is giving up its remaining time slice
Returns
The handle of the next thread to run or INVALID_HANDLE_VALUE on no selection or error
Note
Called either by scheduler interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread Or by scheduler reschedule with IRQ or FIQ disabled and running on the current thread
Caller must either hold a lock on the current thread or have disabled IRQ or FIQ

◆ scheduler_reschedule()

uint32_t STDCALL scheduler_reschedule ( BOOL yield)

Perform a thread switch operation when a thread yields, sleeps or waits.

The next thread to run will be selected based on whether the current thread is yielding or no longer ready, remaining quantum of the current thread, ready threads at higher priority levels and scheduler priority quantum for fair scheduling of lower priority threads

Parameters
YieldTrue if the current thread is giving up its remaining time slice
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Called by the currently running thread to force a reschedule before sleeping, waiting etc

◆ scheduler_migration_enable()

uint32_t STDCALL scheduler_migration_enable ( void )

Enable scheduler thread migration.

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ scheduler_migration_disable()

uint32_t STDCALL scheduler_migration_disable ( void )

Disable scheduler thread migration.

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ scheduler_preempt_enable()

uint32_t STDCALL scheduler_preempt_enable ( uint32_t cpuid)

Enable thread preemption for the specified CPU.

Parameters
CPUIDThe ID of the CPU to enable for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ scheduler_preempt_disable()

uint32_t STDCALL scheduler_preempt_disable ( uint32_t cpuid)

Disable thread preemption for the specified CPU.

Parameters
CPUIDThe ID of the CPU to disable for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ scheduler_allocation_enable()

uint32_t STDCALL scheduler_allocation_enable ( uint32_t cpuid)

Enable thread allocation for the specified CPU.

Parameters
CPUIDThe ID of the CPU to enable for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ scheduler_allocation_disable()

uint32_t STDCALL scheduler_allocation_disable ( uint32_t cpuid)

Disable thread allocation for the specified CPU.

Parameters
CPUIDThe ID of the CPU to disable for
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ messageslot_create()

MESSAGESLOT_HANDLE STDCALL messageslot_create ( void )

Create and insert a new Messageslot entry.

Messageslot Functions

Returns
Handle of new Messageslot entry or INVALID_HANDLE_VALUE if entry could not be created

◆ messageslot_create_ex()

MESSAGESLOT_HANDLE STDCALL messageslot_create_ex ( uint32_t maximum,
uint32_t flags )

Create and insert a new Messageslot entry.

Parameters
MaximumMaximum number of messages allowed for the Messageslot (Must be greater than zero)
FlagsThe flags for the Messageslot entry (eg MESSAGESLOT_FLAG_IRQ)
Returns
Handle of new Messageslot entry or INVALID_HANDLE_VALUE if entry could not be created

◆ messageslot_destroy()

uint32_t STDCALL messageslot_destroy ( MESSAGESLOT_HANDLE messageslot)

Destroy and remove an existing Messageslot entry.

Parameters
MessageslotHandle of Messageslot entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ messageslot_count()

uint32_t STDCALL messageslot_count ( MESSAGESLOT_HANDLE messageslot)

Get the number of available messages in a Messageslot entry.

Parameters
MessageslotMessageslot to get from
Returns
Number of messages or INVALID_HANDLE_VALUE on error

◆ messageslot_send()

uint32_t STDCALL messageslot_send ( MESSAGESLOT_HANDLE messageslot,
THREAD_MESSAGE * message )

Send a message to a Messageslot.

Parameters
MessageslotMessageslot to send to
MessageContents of message to send
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ messageslot_receive()

uint32_t STDCALL messageslot_receive ( MESSAGESLOT_HANDLE messageslot,
THREAD_MESSAGE * message )

Receive a message from a Messageslot.

Parameters
MessageslotMessageslot to receive from
MessageThe received message if successful, undefined on error
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ messageslot_receive_ex()

uint32_t STDCALL messageslot_receive_ex ( MESSAGESLOT_HANDLE messageslot,
THREAD_MESSAGE * message,
uint32_t timeout )

Receive a message from a Messageslot.

Parameters
MessageslotMessageslot to receive from
MessageThe received message if successful, undefined on error
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ mailslot_create()

MAILSLOT_HANDLE STDCALL mailslot_create ( uint32_t maximum)

Create and insert a new Mailslot entry.

Mailslot Functions

Parameters
MaximumMaximum number of messages allowed for the Mailslot (Must be greater than zero)
Returns
Handle of new Mailslot entry or INVALID_HANDLE_VALUE if entry could not be created

◆ mailslot_destroy()

uint32_t STDCALL mailslot_destroy ( MAILSLOT_HANDLE mailslot)

Destroy and remove an existing Mailslot entry.

Parameters
MailslotHandle of Mailslot entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mailslot_count()

uint32_t STDCALL mailslot_count ( MAILSLOT_HANDLE mailslot)

Get the number of available messages in a Mailslot entry.

Parameters
MailslotMailslot to get from
Returns
Number of messages or INVALID_HANDLE_VALUE on error

◆ mailslot_send()

uint32_t STDCALL mailslot_send ( MAILSLOT_HANDLE mailslot,
ssize_t data )

Send a message to a Mailslot.

Parameters
MailslotMailslot to send to
DataMessage to send to mailslot
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ mailslot_send_ex()

uint32_t STDCALL mailslot_send_ex ( MAILSLOT_HANDLE mailslot,
ssize_t data,
uint32_t timeout )

Send a message to a Mailslot.

Parameters
MailslotMailslot to send to
DataMessage to send to mailslot
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ mailslot_receive()

ssize_t STDCALL mailslot_receive ( MAILSLOT_HANDLE mailslot)

Receive a message from a Mailslot.

Parameters
MailslotMailslot to receive from
Returns
Received message or INVALID_HANDLE_VALUE on error

◆ mailslot_receive_ex()

ssize_t STDCALL mailslot_receive_ex ( MAILSLOT_HANDLE mailslot,
uint32_t timeout )

Receive a message from a Mailslot.

Parameters
MailslotMailslot to receive from
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
Received message or INVALID_HANDLE_VALUE on error Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ buffer_create()

BUFFER_HANDLE STDCALL buffer_create ( uint32_t size,
uint32_t count )

Create and insert a new Buffer entry.

Buffer Functions

Parameters
SizeSize of each buffer in bytes
CountTotal number of buffers
Returns
Handle of new Buffer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ buffer_create_ex()

BUFFER_HANDLE STDCALL buffer_create_ex ( uint32_t size,
uint32_t count,
uint32_t flags )

Create and insert a new Buffer entry.

Parameters
SizeSize of each buffer in bytes
CountTotal number of buffers
FlagsFlags for buffer (eg BUFFER_FLAG_SHARED)
Returns
Handle of new Buffer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ buffer_destroy()

uint32_t STDCALL buffer_destroy ( BUFFER_HANDLE buffer)

Destroy and remove an existing Buffer entry.

Parameters
BufferHandle of Buffer entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ buffer_count()

uint32_t STDCALL buffer_count ( BUFFER_HANDLE buffer)

Get the total count of buffers in an existing Buffer entry.

Parameters
BufferBuffer to get total count for
Returns
Total count or INVALID_HANDLE_VALUE on error

◆ buffer_available()

uint32_t STDCALL buffer_available ( BUFFER_HANDLE buffer)

Get the available count of buffers in an existing Buffer entry.

Parameters
BufferBuffer to get available count for
Returns
Available count or INVALID_HANDLE_VALUE on error

◆ buffer_get()

void *STDCALL buffer_get ( BUFFER_HANDLE buffer)

Allocate an available buffer from an existing Buffer entry.

Parameters
BufferHandle of Buffer entry to allocate from
Returns
A pointer to the allocated buffer or nil on error

◆ buffer_get_ex()

void *STDCALL buffer_get_ex ( BUFFER_HANDLE buffer,
uint32_t timeout )

Allocate an available buffer from an existing Buffer entry.

Parameters
BufferHandle of Buffer entry to allocate from
TimeoutMilliseconds to wait before timeout (0 equals do not wait, INFINITE equals wait forever)
Returns
A pointer to the allocated buffer or nil on error Timeout = 0 then No Wait,Timeout = INFINITE then Wait forever

◆ buffer_free()

uint32_t STDCALL buffer_free ( void * buffer)

Release a allocated buffer from an existing Buffer entry.

Parameters
BufferPointer to the allocated buffer (As returned by BufferGet/BufferGetEx)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ buffer_iterate()

void *STDCALL buffer_iterate ( BUFFER_HANDLE buffer,
void * previous )

Iterate through each of the buffers in an existing Buffer entry.

Parameters
BufferHandle of Buffer entry to iterate from
PreviousThe pointer returned by the previous call or nil on first call
Returns
A pointer to the next buffer or nil on error
Note
Iterate is intended to allow allocating or initializing buffers after a Buffer entry is created, or deallocating before a Buffer entry is destroyed.

The function will fail if any buffers are already in use (if the count and available count are not equal)

◆ event_create()

EVENT_HANDLE STDCALL event_create ( BOOL manualreset,
BOOL initialstate )

Create and insert a new Event entry.

Event Functions

Parameters
ManualResetCreate a manual reset event if true or an auto reset event if false An manual reset event must be reset by calling EventReset An auto reset event is reset when a single waiting thread is released
InitialStateSet the initial state of the event to signaled if true or to unsignaled if false
Returns
Handle of new Event entry or INVALID_HANDLE_VALUE if entry could not be created

◆ event_create_ex()

EVENT_HANDLE STDCALL event_create_ex ( uint32_t flags)

Create and insert a new Event entry.

Parameters
FlagsEvent flags to use for the new entry (eg EVENT_FLAG_MANUAL_RESET)
Returns
Handle of new Event entry or INVALID_HANDLE_VALUE if entry could not be created

◆ event_destroy()

uint32_t STDCALL event_destroy ( EVENT_HANDLE event)

Destroy and remove an existing Event entry.

Parameters
EventHandle of Event entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ event_state()

uint32_t STDCALL event_state ( EVENT_HANDLE event)

Get the current state of an existing Event entry.

Parameters
EventEvent to get state for
Returns
Current state or INVALID_HANDLE_VALUE on error

◆ event_wait()

uint32_t STDCALL event_wait ( EVENT_HANDLE event)

Wait on an existing Event entry.

If the Event is currently signaled then simply return immediately

If the Event is currently unsignaled then wait for it to be signaled before returning

Parameters
EventEvent to wait on
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ event_wait_ex()

uint32_t STDCALL event_wait_ex ( EVENT_HANDLE event,
uint32_t timeout )

Wait on an existing Event entry.

If the Event is currently signaled then simply return immediately

If the Event is currently unsignaled then wait for it to be signaled before returning

Parameters
EventEvent to wait on
TimeoutTime in milliseconds to wait for the event to be signaled 0 = No Wait INFINITE = Wait Indefinitely
Returns
ERROR_SUCCESS if completed or another error code on failure Timeout = 0 then no Wait,Timeout = INFINITE then Wait forever

◆ event_set()

uint32_t STDCALL event_set ( EVENT_HANDLE event)

Set (Signal) an existing Event entry.

If the event is currently signaled then return with no action

If the event is unsignaled then, if the event is manual reset release all waiting threads and return. If the event is auto reset release one waiting thread, unsignal the event and return

If no threads are waiting then simply signal the event and return, if the event is auto reset then the next thread to wait will unsignal the event

Parameters
EventEvent to set
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ event_reset()

uint32_t STDCALL event_reset ( EVENT_HANDLE event)

Reset (Unsignal) an existing Event entry.

If the event is currently unsignaled then return with no action

If the event is signaled then unsignal the event and return

Parameters
EventEvent to reset
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ event_pulse()

uint32_t STDCALL event_pulse ( EVENT_HANDLE event)

Pulse (Set then Reset) an existing Event entry.

If the event is currently signaled then unsignal the event and return

If the event is unsignaled then, if the event is manual reset release all waiting threads, unsignal the event and return. If the event is auto reset release one waiting thread, unsignal the event and return

If no threads are waiting then simply unsignal the event and return

Parameters
EventEvent to pulse
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ timer_create()

TIMER_HANDLE STDCALL timer_create ( uint32_t interval,
BOOL enabled,
BOOL reschedule,
timer_event_proc event,
void * data )

Create and insert a new Timer entry.

Timer Functions

Parameters
IntervalNumber of milliseconds between timer events
EnabledIf true then timer generates events
RescheduleIf true then reschedule timer after each event
EventThe function to call when the timer event is generated
DataData to be passed to the function when the timer event is generated (May be nil)
Returns
Handle of new Timer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ timer_create_ex()

TIMER_HANDLE STDCALL timer_create_ex ( uint32_t interval,
uint32_t state,
uint32_t flags,
timer_event_proc event,
void * data )

Create and insert a new Timer entry.

Parameters
IntervalNumber of milliseconds between timer events
StateState of timer entry (eg TIMER_STATE_ENABLED)
FlagsFlags of timer entry (eg TIMER_FLAG_RESCHEDULE)
EventThe function to call when the timer event is generated
DataData to be passed to the function when the timer event is generated (May be nil)
Returns
Handle of new Timer entry or INVALID_HANDLE_VALUE if entry could not be created

◆ timer_destroy()

uint32_t STDCALL timer_destroy ( TIMER_HANDLE timer)

Destroy and remove an existing Timer entry.

Parameters
TimerHandle of Timer entry to destroy
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ timer_enable()

uint32_t STDCALL timer_enable ( TIMER_HANDLE timer)

Enable an existing Timer entry (Timer events will be generated).

Parameters
TimerHandle of Timer entry to enable
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ timer_enable_ex()

uint32_t STDCALL timer_enable_ex ( TIMER_HANDLE timer,
uint32_t interval,
timer_event_proc event,
void * data )

Enable and update an existing Timer entry (Timer events will be generated).

Parameters
TimerHandle of Timer entry to enable
IntervalNumber of milliseconds between timer events
EventThe function to call when the timer event is generated
DataData to be passed to the function when the timer event is generated (May be nil)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ timer_disable()

uint32_t STDCALL timer_disable ( TIMER_HANDLE timer)

Disable an existing Timer entry (Timer events will not be generated).

Parameters
TimerHandle of Timer entry to disable
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ timer_dequeue()

TIMER_HANDLE STDCALL timer_dequeue ( void )

Get and remove the first timer from the Timer list.

Returns
Handle of dequeued Timer or INVALID_HANDLE_VALUE on failure

◆ timer_first_key()

int STDCALL timer_first_key ( void )

Get the first Key value from the Timer list.

Returns
First Key value from timer list or TIMER_KEY_NONE on failure

◆ timer_insert_key()

uint32_t STDCALL timer_insert_key ( TIMER_HANDLE timer,
int key )

Insert the supplied timer in the Timer list in delta ascending order based on Key.

Parameters
TimerHandle of timer to be inserted
KeyThe key to order the insertion on
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the timer

◆ timer_delete_key()

uint32_t STDCALL timer_delete_key ( TIMER_HANDLE timer)

Delete the supplied timer from the Timer list.

Parameters
TimerHandle of timer to be deleted
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Caller must hold the lock on the timer

◆ timer_decrement_key()

int STDCALL timer_decrement_key ( void )

Decrement the first Key value in the Timer list.

Returns
First Key value in timer list after decrement or TIMER_KEY_NONE on failure

◆ timer_is_empty()

BOOL STDCALL timer_is_empty ( void )

Check if the Timer list is empty.

Returns
True if Timer list is empty or does not exist, False if Timer list is not empty

◆ timer_not_empty()

BOOL STDCALL timer_not_empty ( void )

Check if the Timer list is not empty.

Returns
True if Timer list is not empty, False if Timer list is empty or does not exist

◆ timer_check()

uint32_t STDCALL timer_check ( void )

Check if the timer list is empty, if not then decrement the first key.

If the key reaches zero, return success to indicate there are timers to be triggered

Returns
ERROR_SUCCESS if the first key is zero, ERROR_NO_MORE_ITEMS if list is empty or another error code on failure
Note
Called by clock interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ timer_trigger()

uint32_t STDCALL timer_trigger ( void )

Remove all entries from the timer list that have reached their interval.

For each timer a message will be sent to the Timer thread to call the event

Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Called by clock interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ worker_schedule()

uint32_t STDCALL worker_schedule ( uint32_t interval,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread now or in the future.

Worker Functions

Parameters
IntervalThe number of milliseconds before the task is to be performed (0 for immediate)
TaskThe function to be called by the worker when the interval has elapsed
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ worker_schedule_ex()

WORKER_HANDLE STDCALL worker_schedule_ex ( uint32_t interval,
uint32_t flags,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread now or in the future.

Parameters
IntervalThe number of milliseconds before the task is to be performed (0 for immediate)
FlagsThe flags for the task (eg WORKER_FLAG_RESCHEDULE)
TaskThe function to be called by the worker when the interval has elapsed
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
Handle of new Worker task or INVALID_HANDLE_VALUE if task could not be created
Note
If the flags do not contain WORKER_FLAG_RESCHEDULE then return will be ERROR_SUCCESS

◆ worker_cancel()

uint32_t STDCALL worker_cancel ( WORKER_HANDLE worker)

Cancel a previously scheduled worker thread task.

Parameters
WorkerThe handle of the worker task to cancel
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ worker_schedule_irq()

uint32_t STDCALL worker_schedule_irq ( uint32_t affinity,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread when the caller is an IRQ handler.

Parameters
AffinityCPU Affinity for memory allocation (eg CPU_AFFINITY_0 or CPU_AFFINITY_NONE)
TaskThe function to be called by the worker
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The task will be performed immediately, for delayed tasks etc see WorkerSchedule(Ex)

◆ worker_schedule_irq_ex()

uint32_t STDCALL worker_schedule_irq_ex ( uint32_t affinity,
uint32_t flags,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread when the caller is an IRQ handler.

Parameters
AffinityCPU Affinity for memory allocation (eg CPU_AFFINITY_0 or CPU_AFFINITY_NONE)
FlagsThe flags for the task (eg WORKER_FLAG_PRIORITY)
TaskThe function to be called by the worker
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The task will be performed immediately, for delayed tasks etc see WorkerSchedule(Ex)

◆ worker_schedule_fiq()

uint32_t STDCALL worker_schedule_fiq ( uint32_t affinity,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread when the caller is an FIQ handler.

Parameters
AffinityCPU Affinity for memory allocation (eg CPU_AFFINITY_0 or CPU_AFFINITY_NONE)
TaskThe function to be called by the worker
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The task will be performed immediately, for delayed tasks etc see WorkerSchedule(Ex)

◆ worker_schedule_fiq_ex()

uint32_t STDCALL worker_schedule_fiq_ex ( uint32_t affinity,
uint32_t flags,
worker_task_proc task,
void * data,
worker_cb callback )

Schedule a task to be performed by a worker thread when the caller is an FIQ handler.

Parameters
AffinityCPU Affinity for memory allocation (eg CPU_AFFINITY_0 or CPU_AFFINITY_NONE)
FlagsThe flags for the task (eg WORKER_FLAG_PRIORITY)
TaskThe function to be called by the worker
DataA pointer to user defined data which will be passed to the task function (Optional)
CallbackThe function to be called by the worker when the task has completed (Optional)
Returns
ERROR_SUCCESS if completed or another error code on failure
Note
The task will be performed immediately, for delayed tasks etc see WorkerSchedule(Ex)

◆ worker_increase()

uint32_t STDCALL worker_increase ( uint32_t count)

Increase the number of worker threads available.

Parameters
CountNumber of worker threads to increase by
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ worker_increase_ex()

uint32_t STDCALL worker_increase_ex ( uint32_t count,
BOOL priority )

Increase the number of worker threads available.

Parameters
CountNumber of worker threads to increase by
PriorityIf true increase worker priority threads
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ worker_decrease()

uint32_t STDCALL worker_decrease ( uint32_t count)

Decrease the number of worker threads available.

Parameters
CountNumber of worker threads to decrease by
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ worker_decrease_ex()

uint32_t STDCALL worker_decrease_ex ( uint32_t count,
BOOL priority )

Decrease the number of worker threads available.

Parameters
CountNumber of worker threads to decrease by
PriorityIf true decrease worker priority threads
Returns
ERROR_SUCCESS if completed or another error code on failure

◆ tasker_thread_send_message()

uint32_t STDCALL tasker_thread_send_message ( THREAD_HANDLE thread,
THREAD_MESSAGE * message )

Perform a ThreadSendMessage() function call using the tasker list.

Tasker Functions

◆ tasker_messageslot_send()

uint32_t STDCALL tasker_messageslot_send ( MESSAGESLOT_HANDLE messageslot,
THREAD_MESSAGE * message )

Perform a MessageslotSend() function call using the tasker list.

◆ tasker_semaphore_signal()

uint32_t STDCALL tasker_semaphore_signal ( SEMAPHORE_HANDLE semaphore,
uint32_t count )

Perform a SemaphoreSignal() function call using the tasker list.

◆ tasker_completion_reset()

uint32_t STDCALL tasker_completion_reset ( COMPLETION_HANDLE completion)

Perform a CompletionReset() function call using the tasker list.

◆ tasker_completion_complete()

uint32_t STDCALL tasker_completion_complete ( COMPLETION_HANDLE completion,
BOOL all )

Perform a CompletionComplete() or CompletionCompleteAll() function call using the tasker list.

◆ tasker_enqueue()

uint32_t STDCALL tasker_enqueue ( TASKER_TASK * task)

Add the supplied task to the end of the Tasker list.

Returns
ERROR_SUCCESS if completed or another error code on failure

◆ tasker_dequeue()

TASKER_TASK *STDCALL tasker_dequeue ( void )

Get and remove the first task from the Tasker list.

Returns
Dequeued Task or nil on failure (or list empty)

◆ tasker_check()

uint32_t STDCALL tasker_check ( void )

Check if the tasker list is empty or contains tasks.

Returns
ERROR_SUCCESS if the list contains tasks, ERROR_NO_MORE_ITEMS if list is empty or another error code on failure
Note
Called by clock interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ tasker_trigger()

uint32_t STDCALL tasker_trigger ( void )

Dequeue all tasks in the tasker list and perform the requested task for each.

Returns
ERROR_SUCCESS if completed or another error code on failure
Note
Called by clock interrupt with IRQ or FIQ disabled and running on the IRQ or FIQ thread

◆ begin_thread()

THREAD_ID STDCALL begin_thread ( void * signalaction,
size_t stacksize,
thread_func threadfunction,
void * threadparameter,
uint32_t creationflags,
THREAD_ID * threadid )

Start a new thread.

RTL Thread Manager Functions See: \source\rtl\inc\thread.inc and \source\rtl\inc\threadh.inc See: \source\rtl\inc\system.inc and \source\rtl\inc\systemh.inc

Parameters
SignalActionNot used by Ultibo
StackSizeThe stack size for the new thread
ThreadFunctionThe function to be executed by the new thread
ThreadParameterA pointer to be passed to ThreadFunction (Optional)
CreationFlagsFlags to determine how the new thread is created (eg THREAD_CREATE_SUSPENDED)
ThreadIdFilled with the thread ID of the new thread on return
Note
SignalAction not used by Ultibo threading

◆ begin_thread_ex()

THREAD_ID STDCALL begin_thread_ex ( void * signalaction,
size_t stacksize,
thread_func threadfunction,
void * threadparameter,
uint32_t creationflags,
uint32_t priority,
uint32_t affinity,
uint32_t cpu,
const char * name,
THREAD_ID * threadid )

Start a new thread.

Parameters
SignalActionNot used by Ultibo
StackSizeThe stack size for the new thread
ThreadFunctionThe function to be executed by the new thread
ThreadParameterA pointer to be passed to ThreadFunction (Optional)
CreationFlagsFlags to determine how the new thread is created (eg THREAD_CREATE_SUSPENDED)
PriorityThe priority of the new thread (eg THREAD_PRIORITY_NORMAL)
AffinityThe CPU affinity of the new thread (eg CPU_AFFINITY_ALL)
CPUThe CPU to assign new thread to (eg CPU_ID_0)
NameThe name of the new thread
ThreadIdFilled with the thread ID of the new thread on return
Note
SignalAction not used by Ultibo threading

◆ end_thread()

void STDCALL end_thread ( uint32_t exitcode)

End the current thread.

Parameters
ExitCodeThe exit code returned by a call to ThreadGetExitCode

◆ spin_get_count()

uint32_t STDCALL spin_get_count ( void )

Get the current spin lock count.

Thread Helper Functions

◆ mutex_get_count()

uint32_t STDCALL mutex_get_count ( void )

Get the current mutex count.

◆ critical_section_get_count()

uint32_t STDCALL critical_section_get_count ( void )

Get the current critical section count.

◆ semaphore_get_count()

uint32_t STDCALL semaphore_get_count ( void )

Get the current semaphore count.

◆ synchronizer_get_count()

uint32_t STDCALL synchronizer_get_count ( void )

Get the current synchronizer count.

◆ condition_get_count()

uint32_t STDCALL condition_get_count ( void )

Get the current condition count.

◆ completion_get_count()

uint32_t STDCALL completion_get_count ( void )

Get the current completion count.

◆ list_get_count()

uint32_t STDCALL list_get_count ( void )

Get the current list count.

◆ queue_get_count()

uint32_t STDCALL queue_get_count ( void )

Get the current queue count.

◆ thread_get_count()

uint32_t STDCALL thread_get_count ( void )

Get the current thread count.

◆ thread_tls_get_count()

uint32_t STDCALL thread_tls_get_count ( void )

Get the current thread tls count.

◆ thread_allocate_stack()

void *STDCALL thread_allocate_stack ( uint32_t stacksize)

Allocate memory for a new thread stack.

Parameters
StackSizeNumber of bytes requested for new thread stack
Returns
nil if StackSize was 0 or if there is not enough memory to satisfy the request Otherwise returns a pointer to the top (highest address) of the newly allocated memory region This address is the base of the stack which grows down in memory

◆ thread_release_stack()

void STDCALL thread_release_stack ( void * stackbase,
uint32_t stacksize )

Release a thread stack allocated with ThreadAllocateStack.

Parameters
StackBasePointer to the top (highest address) of the thread stack (as returned by ThreadAllocateStack
StackSizeSize of the thread stack, in bytes (Same value passed to ThreadAllocateStack)

◆ thread_setup_stack()

void *STDCALL thread_setup_stack ( void * stackbase,
thread_start_proc startproc,
thread_end_proc returnproc,
void * parameter )

◆ thread_snapshot_create()

THREAD_SNAPSHOT *STDCALL thread_snapshot_create ( void )

◆ thread_snapshot_destroy()

uint32_t STDCALL thread_snapshot_destroy ( THREAD_SNAPSHOT * snapshot)

◆ messageslot_get_count()

uint32_t STDCALL messageslot_get_count ( void )

Get the current messageslot count.

◆ mailslot_get_count()

uint32_t STDCALL mailslot_get_count ( void )

Get the current mailslot count.

◆ buffer_get_count()

uint32_t STDCALL buffer_get_count ( void )

Get the current buffer count.

◆ event_get_count()

uint32_t STDCALL event_get_count ( void )

Get the current event count.

◆ timer_get_count()

uint32_t STDCALL timer_get_count ( void )

Get the current timer count.

◆ worker_get_count()

uint32_t STDCALL worker_get_count ( void )

Get the current worker thread count.

◆ worker_get_priority_count()

uint32_t STDCALL worker_get_priority_count ( void )

Get the current worker priority thread count.

◆ tasker_get_count()

uint32_t STDCALL tasker_get_count ( void )

Get the current tasker count.

◆ list_type_to_string()

uint32_t STDCALL list_type_to_string ( uint32_t listtype,
char * string,
uint32_t len )

◆ queue_type_to_string()

uint32_t STDCALL queue_type_to_string ( uint32_t queuetype,
char * string,
uint32_t len )

◆ thread_type_to_string()

uint32_t STDCALL thread_type_to_string ( uint32_t threadtype,
char * string,
uint32_t len )

◆ thread_state_to_string()

uint32_t STDCALL thread_state_to_string ( uint32_t threadstate,
char * string,
uint32_t len )

◆ thread_priority_to_string()

uint32_t STDCALL thread_priority_to_string ( uint32_t threadpriority,
char * string,
uint32_t len )

◆ scheduler_get_list_flags()

uint32_t STDCALL scheduler_get_list_flags ( uint32_t listtype)

Get the list flags for the specified type of list.

Scheduler Helper Functions

◆ scheduler_get_queue_flags()

uint32_t STDCALL scheduler_get_queue_flags ( uint32_t queuetype)

Get the queue flags for the specified type of scheduler queue.

◆ scheduler_get_queue_handle()

QUEUE_HANDLE STDCALL scheduler_get_queue_handle ( uint32_t cpuid,
uint32_t queuetype )

Get the queue handle for the specified type of scheduler queue on the specified CPU.

◆ scheduler_get_queue_handle_ex()

QUEUE_HANDLE STDCALL scheduler_get_queue_handle_ex ( uint32_t cpuid,
uint32_t priority )

Get the queue handle for the specified thread priority on the specified CPU.

◆ scheduler_get_thread_count()

uint32_t STDCALL scheduler_get_thread_count ( uint32_t cpuid)

Get the thread count for the specified CPU.

◆ scheduler_get_thread_quantum()

uint32_t STDCALL scheduler_get_thread_quantum ( uint32_t cpuid)

Get the current thread quantum for the specified CPU.

◆ scheduler_get_thread_handle()

THREAD_HANDLE STDCALL scheduler_get_thread_handle ( uint32_t cpuid,
uint32_t threadtype )

Get the thread handle for the specified type of thread on the specified CPU.

◆ scheduler_get_priority_mask()

uint32_t STDCALL scheduler_get_priority_mask ( uint32_t cpuid)

Get the current priority mask for the specified CPU.

◆ scheduler_get_priority_quantum()

uint32_t STDCALL scheduler_get_priority_quantum ( uint32_t priority)

Get the scheduler quantum for the specified thread priority.

◆ scheduler_set_priority_quantum()

uint32_t STDCALL scheduler_set_priority_quantum ( uint32_t priority,
uint32_t quantum )

Set the scheduler quantum for the specified thread priority.

◆ scheduler_get_migration_quantum()

uint32_t STDCALL scheduler_get_migration_quantum ( void )

Get the current migration quantum.

◆ scheduler_get_starvation_quantum()

uint32_t STDCALL scheduler_get_starvation_quantum ( uint32_t cpuid)

Get the current starvation quantum for the specified CPU.

◆ scheduler_get_thread_next()

uint32_t STDCALL scheduler_get_thread_next ( void )

Get the next CPU for thread allocation.

◆ scheduler_get_thread_migration()

uint32_t STDCALL scheduler_get_thread_migration ( void )

Get the current thread migration setting.

◆ scheduler_get_thread_preempt()

uint32_t STDCALL scheduler_get_thread_preempt ( uint32_t cpuid)

Get the current thread preempt setting for the specified CPU.

◆ scheduler_get_thread_allocation()

uint32_t STDCALL scheduler_get_thread_allocation ( uint32_t cpuid)

Get the current thread allocation setting for the specified CPU.

◆ scheduler_migration_to_string()

uint32_t STDCALL scheduler_migration_to_string ( uint32_t migration,
char * string,
uint32_t len )

◆ scheduler_preempt_to_string()

uint32_t STDCALL scheduler_preempt_to_string ( uint32_t preempt,
char * string,
uint32_t len )

◆ scheduler_allocation_to_string()

uint32_t STDCALL scheduler_allocation_to_string ( uint32_t allocation,
char * string,
uint32_t len )

◆ timer_get_list_flags()

uint32_t STDCALL timer_get_list_flags ( void )

Get the lock flags for the timer list.

Timer Helper Functions

◆ timer_get_messageslot_flags()

uint32_t STDCALL timer_get_messageslot_flags ( void )

Get the lock flags for the timer messageslot.

◆ worker_get_messageslot_flags()

uint32_t STDCALL worker_get_messageslot_flags ( void )

Get the lock flags for the worker messageslot.

Worker Helper Functions