26#ifndef _ULTIBO_THREADS_H
27#define _ULTIBO_THREADS_H
42#define LOCK_FLAG_NONE 0x00000000
43#define LOCK_FLAG_IRQ 0x00000001
44#define LOCK_FLAG_FIQ 0x00000002
45#define LOCK_FLAG_IRQFIQ 0x00000004
48#define SPIN_SIGNATURE 0x0FEC3B82
51#define SPIN_STATE_UNLOCKED 0
52#define SPIN_STATE_LOCKED 1
55#define MUTEX_SIGNATURE 0x1C5D7FA4
58#define MUTEX_STATE_UNLOCKED 0
59#define MUTEX_STATE_LOCKED 1
62#define MUTEX_FLAG_NONE 0x00000000
63#define MUTEX_FLAG_RECURSIVE 0x00000001
64#define MUTEX_FLAG_ERRORCHECK 0x00000002
67#define CRITICAL_SECTION_SIGNATURE 0x25F3AE01
70#define CRITICAL_SECTION_STATE_UNLOCKED 0
71#define CRITICAL_SECTION_STATE_LOCKED 1
74#define SEMAPHORE_SIGNATURE 0x390A1EB4
77#define SEMAPHORE_FLAG_NONE LOCK_FLAG_NONE
78#define SEMAPHORE_FLAG_IRQ LOCK_FLAG_IRQ
79#define SEMAPHORE_FLAG_FIQ LOCK_FLAG_FIQ
80#define SEMAPHORE_FLAG_IRQFIQ LOCK_FLAG_IRQFIQ
83#define SYNCHRONIZER_SIGNATURE 0xC5D081FB
86#define SYNCHRONIZER_STATE_UNLOCKED 0
87#define SYNCHRONIZER_STATE_READER_LOCKED 1
88#define SYNCHRONIZER_STATE_WRITER_LOCKED 2
91#define SYNCHRONIZER_FLAG_NONE 0x00000000
92#define SYNCHRONIZER_FLAG_READ_PRIORITY 0x00000001
93#define SYNCHRONIZER_FLAG_WRITE_PRIORITY 0x00000002
96#define CONDITION_SIGNATURE 0xD14D3C0A
99#define CONDITION_FLAG_NONE 0x00000000
102#define CONDITION_LOCK_FLAG_NONE 0x00000000
103#define CONDITION_LOCK_FLAG_WRITER 0x00000001
106#define COMPLETION_SIGNATURE 0xFCE24CA1
109#define COMPLETION_STATE_RESET 0
110#define COMPLETION_STATE_COMPLETE 1
113#define COMPLETION_FLAG_NONE LOCK_FLAG_NONE
114#define COMPLETION_FLAG_IRQ LOCK_FLAG_IRQ
115#define COMPLETION_FLAG_FIQ LOCK_FLAG_FIQ
116#define COMPLETION_FLAG_IRQFIQ LOCK_FLAG_IRQFIQ
117#define COMPLETION_FLAG_COUNTED 0x00000008
120#define LIST_SIGNATURE 0x4A98BE2A
123#define LIST_TYPE_NOT_SPECIFIED 0
124#define LIST_TYPE_WAIT_SECTION 1
125#define LIST_TYPE_WAIT_SEMAPHORE 2
126#define LIST_TYPE_WAIT_SYNCHRONIZER 3
127#define LIST_TYPE_WAIT_CONDITION 4
128#define LIST_TYPE_WAIT_COMPLETION 5
129#define LIST_TYPE_WAIT_EVENT 6
130#define LIST_TYPE_WAIT_THREAD 7
131#define LIST_TYPE_WAIT_MESSAGESLOT 8
132#define LIST_TYPE_WAIT_OTHER 9
135#define LIST_FLAG_NONE LOCK_FLAG_NONE
136#define LIST_FLAG_IRQ LOCK_FLAG_IRQ
137#define LIST_FLAG_FIQ LOCK_FLAG_FIQ
138#define LIST_FLAG_IRQFIQ LOCK_FLAG_IRQFIQ
141#define QUEUE_SIGNATURE 0x57A3BF9E
144#define QUEUE_TYPE_NOT_SPECIFIED 0
145#define QUEUE_TYPE_SCHEDULE_SLEEP 1
146#define QUEUE_TYPE_SCHEDULE_TIMEOUT 2
147#define QUEUE_TYPE_SCHEDULE_TERMINATION 3
148#define QUEUE_TYPE_SCHEDULE_NONE 4
149#define QUEUE_TYPE_SCHEDULE_IDLE 5
150#define QUEUE_TYPE_SCHEDULE_LOWEST 6
151#define QUEUE_TYPE_SCHEDULE_LOWER 7
152#define QUEUE_TYPE_SCHEDULE_NORMAL 8
153#define QUEUE_TYPE_SCHEDULE_HIGHER 9
154#define QUEUE_TYPE_SCHEDULE_HIGHEST 10
155#define QUEUE_TYPE_SCHEDULE_CRITICAL 11
158#define QUEUE_FLAG_NONE LOCK_FLAG_NONE
159#define QUEUE_FLAG_IRQ LOCK_FLAG_IRQ
160#define QUEUE_FLAG_FIQ LOCK_FLAG_FIQ
161#define QUEUE_FLAG_IRQFIQ LOCK_FLAG_IRQFIQ
162#define QUEUE_FLAG_DESCENDING 0x00000008
163#define QUEUE_FLAG_DELTA 0x00000010
166#define QUEUE_KEY_NONE (int32_t)0x7FFFFFFF
167#define QUEUE_KEY_MAX (int32_t)0x7FFFFFFE
168#define QUEUE_KEY_MIN (int32_t)0x80000000
171#define THREAD_SIGNATURE 0x6C2BA10F
174#define THREAD_TYPE_NORMAL 0
175#define THREAD_TYPE_IDLE 1
176#define THREAD_TYPE_IRQ 2
177#define THREAD_TYPE_FIQ 3
178#define THREAD_TYPE_SWI 4
181#define THREAD_FLAG_NONE 0x00000000
182#define THREAD_FLAG_PERSIST 0x00000001
183#define THREAD_FLAG_CANCELLED 0x00000002
184#define THREAD_FLAG_CANCEL_DISABLE 0x00000004
185#define THREAD_FLAG_CANCEL_ASYNCHRONOUS 0x00000008
187#define THREAD_FLAG_INTERNAL THREAD_FLAG_NONE + 0x80000000
190#define THREAD_STATE_RUNNING 1
191#define THREAD_STATE_READY 2
192#define THREAD_STATE_SLEEP 3
193#define THREAD_STATE_SUSPENDED 4
194#define THREAD_STATE_WAIT 5
195#define THREAD_STATE_WAIT_TIMEOUT 6
196#define THREAD_STATE_RECEIVE 7
197#define THREAD_STATE_RECEIVE_TIMEOUT 8
198#define THREAD_STATE_HALTED 9
199#define THREAD_STATE_TERMINATED 10
203#define THREAD_PRIORITY_NONE 0
204#define THREAD_PRIORITY_IDLE 1
205#define THREAD_PRIORITY_LOWEST 2
206#define THREAD_PRIORITY_LOWER 3
207#define THREAD_PRIORITY_NORMAL 4
208#define THREAD_PRIORITY_HIGHER 5
209#define THREAD_PRIORITY_HIGHEST 6
210#define THREAD_PRIORITY_CRITICAL 7
212#define THREAD_PRIORITY_DEFAULT THREAD_PRIORITY_NORMAL
213#define THREAD_PRIORITY_MINIMUM THREAD_PRIORITY_IDLE
214#define THREAD_PRIORITY_MAXIMUM THREAD_PRIORITY_CRITICAL
215#define THREAD_PRIORITY_COUNT THREAD_PRIORITY_MAXIMUM + 1
218#define THREAD_PRIORITY_BELOW_NORMAL THREAD_PRIORITY_LOWER
219#define THREAD_PRIORITY_ABOVE_NORMAL THREAD_PRIORITY_HIGHER
220#define THREAD_PRIORITY_TIME_CRITICAL THREAD_PRIORITY_CRITICAL
223#define THREAD_NAME_LENGTH SIZE_64
225#define IRQ_THREAD_NAME "IRQ"
226#define FIQ_THREAD_NAME "FIQ"
227#define SWI_THREAD_NAME "SWI"
228#define IDLE_THREAD_NAME "Idle"
229#define MAIN_THREAD_NAME "Main"
230#define TIMER_THREAD_NAME "Timer"
231#define WORKER_THREAD_NAME "Worker"
232#define TIMER_PRIORITY_THREAD_NAME "Priority Timer"
233#define WORKER_PRIORITY_THREAD_NAME "Priority Worker"
234#define RTL_THREAD_NAME "RTL Thread"
237#define TIMER_THREAD_PRIORITY THREAD_PRIORITY_NORMAL
238#define WORKER_THREAD_PRIORITY THREAD_PRIORITY_NORMAL
239#define TIMER_PRIORITY_THREAD_PRIORITY THREAD_PRIORITY_HIGHEST
240#define WORKER_PRIORITY_THREAD_PRIORITY THREAD_PRIORITY_HIGHER
243#define THREAD_CREATE_NONE 0x00000000
244#define THREAD_CREATE_SUSPENDED 0x00000004
247#define THREAD_TLS_FREE 0x00000000
248#define THREAD_TLS_USED 0x00000001
249#define THREAD_TLS_INVALID 0xFFFFFFFF
251#define THREAD_TLS_MAXIMUM SIZE_64
254#define THREAD_TLS_FLAG_NONE 0x00000000
255#define THREAD_TLS_FLAG_FREE 0x00000001
258#define THREAD_LISTS_MAXIMUM SIZE_64
261#define MESSAGESLOT_SIGNATURE 0xB631CE4B
264#define MESSAGESLOT_FLAG_NONE LOCK_FLAG_NONE
265#define MESSAGESLOT_FLAG_IRQ LOCK_FLAG_IRQ
266#define MESSAGESLOT_FLAG_FIQ LOCK_FLAG_FIQ
267#define MESSAGESLOT_FLAG_IRQFIQ LOCK_FLAG_IRQFIQ
270#define MAILSLOT_SIGNATURE 0x7A409BF3
273#define BUFFER_SIGNATURE 0x830BEA71
276#define BUFFER_FLAG_NONE 0x00000000
277#define BUFFER_FLAG_SHARED 0x00000001
280#define EVENT_SIGNATURE 0x903BA69D
283#define EVENT_STATE_UNSIGNALED 0
284#define EVENT_STATE_SIGNALED 1
287#define EVENT_FLAG_NONE 0x00000000
288#define EVENT_FLAG_INITIAL_STATE 0x00000001
289#define EVENT_FLAG_MANUAL_RESET 0x00000002
292#define TIMER_SIGNATURE 0xAB7E07FB
295#define TIMER_STATE_DISABLED 0
296#define TIMER_STATE_ENABLED 1
299#define TIMER_FLAG_NONE 0x00000000
300#define TIMER_FLAG_RESCHEDULE 0x00000001
301#define TIMER_FLAG_IMMEDIATE 0x00000002
302#define TIMER_FLAG_WORKER 0x00000004
303#define TIMER_FLAG_PRIORITY 0x00000008
306#define TIMER_KEY_NONE (int32_t)0x7FFFFFFF
307#define TIMER_KEY_MAX (int32_t)0x7FFFFFFE
308#define TIMER_KEY_MIN (int32_t)0x80000000
311#define WORKER_SIGNATURE 0xEF6A901B
314#define WORKER_FLAG_NONE 0x00000000
315#define WORKER_FLAG_RESCHEDULE 0x00000001
316#define WORKER_FLAG_IMMEDIATE 0x00000002
317#define WORKER_FLAG_CANCEL 0x00000004
318#define WORKER_FLAG_NOFREE 0x00000008
319#define WORKER_FLAG_TERMINATE 0x00000010
320#define WORKER_FLAG_IRQ 0x00000020
321#define WORKER_FLAG_FIQ 0x00000040
322#define WORKER_FLAG_PRIORITY 0x00000080
324#define WORKER_FLAG_INTERNAL WORKER_FLAG_CANCEL | WORKER_FLAG_NOFREE | WORKER_FLAG_TERMINATE | WORKER_FLAG_IRQ | WORKER_FLAG_FIQ
326#define WORKER_FLAG_EXCLUDED_IRQ WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE
327#define WORKER_FLAG_EXCLUDED_FIQ WORKER_FLAG_RESCHEDULE | WORKER_FLAG_IMMEDIATE
330#define TASKER_TASK_THREADSENDMESSAGE 1
331#define TASKER_TASK_MESSAGESLOTSEND 2
332#define TASKER_TASK_SEMAPHORESIGNAL 3
333#define TASKER_TASK_COMPLETIONRESET 4
334#define TASKER_TASK_COMPLETIONCOMPLETE 5
337#define SCHEDULER_MIGRATION_DISABLED 0
338#define SCHEDULER_MIGRATION_ENABLED 1
341#define SCHEDULER_PREEMPT_DISABLED 0
342#define SCHEDULER_PREEMPT_ENABLED 1
345#define SCHEDULER_ALLOCATION_DISABLED 0
346#define SCHEDULER_ALLOCATION_ENABLED 1
349#define SCHEDULER_MASK_NONE (1 << THREAD_PRIORITY_NONE)
350#define SCHEDULER_MASK_IDLE (1 << THREAD_PRIORITY_IDLE)
351#define SCHEDULER_MASK_LOWEST (1 << THREAD_PRIORITY_LOWEST)
352#define SCHEDULER_MASK_LOWER (1 << THREAD_PRIORITY_LOWER)
353#define SCHEDULER_MASK_NORMAL (1 << THREAD_PRIORITY_NORMAL)
354#define SCHEDULER_MASK_HIGHER (1 << THREAD_PRIORITY_HIGHER)
355#define SCHEDULER_MASK_HIGHEST (1 << THREAD_PRIORITY_HIGHEST)
356#define SCHEDULER_MASK_CRITICAL (1 << THREAD_PRIORITY_CRITICAL)
369#define SCHEDULER_QUANTUM_NONE 0
370#define SCHEDULER_QUANTUM_IDLE 0
371#define SCHEDULER_QUANTUM_LOWEST 1
372#define SCHEDULER_QUANTUM_LOWER 2
373#define SCHEDULER_QUANTUM_NORMAL 4
374#define SCHEDULER_QUANTUM_HIGHER 6
375#define SCHEDULER_QUANTUM_HIGHEST 8
376#define SCHEDULER_QUANTUM_CRITICAL 10
HANDLE EVENT_HANDLE
Definition globaltypes.h:117
HANDLE CRITICAL_SECTION_HANDLE
Definition globaltypes.h:106
int32_t LONGBOOL
Compatibility with FPC LongBool type (4 bytes).
Definition globaltypes.h:56
HANDLE MESSAGESLOT_HANDLE
Definition globaltypes.h:114
#define STDCALL
Definition globaltypes.h:45
HANDLE CONDITION_HANDLE
Definition globaltypes.h:109
HANDLE SPIN_HANDLE
Definition globaltypes.h:104
HANDLE WORKER_HANDLE
Definition globaltypes.h:120
HANDLE MAILSLOT_HANDLE
Definition globaltypes.h:115
_Bool BOOL
Built in Boolean type (1 byte) (Redeclared here for flexibility).
Definition globaltypes.h:55
HANDLE THREAD_HANDLE
Definition globaltypes.h:113
HANDLE SEMAPHORE_HANDLE
Definition globaltypes.h:107
HANDLE BUFFER_HANDLE
Definition globaltypes.h:116
HANDLE COMPLETION_HANDLE
Definition globaltypes.h:110
HANDLE LIST_HANDLE
Definition globaltypes.h:111
HANDLE TIMER_HANDLE
Definition globaltypes.h:119
HANDLE QUEUE_HANDLE
Definition globaltypes.h:112
HANDLE SYNCHRONIZER_HANDLE
Definition globaltypes.h:108
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
uint32_t LCID
To Do.
Definition locale.h:383
BUFFER_ITEM * first
First available buffer item.
Definition threads.h:751
BUFFER_ENTRY * next
Next entry in Buffer table.
Definition threads.h:750
BUFFER_ENTRY * prev
Previous entry in Buffer table.
Definition threads.h:749
BUFFER_ITEM * buffers
Buffer list.
Definition threads.h:747
SPIN_HANDLE lock
Buffer Lock.
Definition threads.h:745
uint32_t flags
Buffer Flags (eg BUFFER_FLAG_SHARED).
Definition threads.h:744
uint32_t count
Number of buffers.
Definition threads.h:743
SEMAPHORE_HANDLE available
Buffer available Semaphore.
Definition threads.h:746
uint32_t size
Size of each buffer.
Definition threads.h:742
uint32_t signature
Signature for entry validation.
Definition threads.h:741
void * buffer
Pointer to item data.
Definition threads.h:760
BUFFER_ITEM * next
Next item in list.
Definition threads.h:759
uint32_t reserved
Align to 16 bytes.
Definition threads.h:761
BUFFER_HANDLE parent
Handle of Buffer owning this item.
Definition threads.h:758
LIST_HANDLE list
List of threads waiting on this Completion (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:528
uint32_t state
State of the completion (Reset/Complete).
Definition threads.h:524
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when Completion is destroyed.
Definition threads.h:532
thread_release_proc release
Release function to call if any threads are waiting when Completion is completed.
Definition threads.h:531
SPIN_HANDLE lock
Completion Lock.
Definition threads.h:527
COMPLETION_ENTRY * next
Next entry in Completion table.
Definition threads.h:535
uint32_t flags
Completion Flags (eg COMPLETION_FLAG_IRQ).
Definition threads.h:526
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Completion.
Definition threads.h:530
uint32_t count
Count of the completion (Only applicable if COMPLETION_FLAG_COUNTED).
Definition threads.h:525
thread_wait_proc wait
Wait function to call to wait on the Completion.
Definition threads.h:529
uint32_t signature
Signature for entry validation.
Definition threads.h:523
COMPLETION_ENTRY * prev
Previous entry in Completion table.
Definition threads.h:534
LIST_HANDLE list
List of threads waiting on this Condition (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:506
CONDITION_ENTRY * next
Next entry in Condition table.
Definition threads.h:513
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when Condition is destroyed.
Definition threads.h:510
CONDITION_ENTRY * prev
Previous entry in Condition table.
Definition threads.h:512
thread_release_proc release
Release function to call if any threads are waiting when Condition is woken.
Definition threads.h:509
SPIN_HANDLE lock
Condition Lock.
Definition threads.h:505
uint32_t flags
Condition Flags (eg CONDITION_FLAG_NONE).
Definition threads.h:504
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Condition.
Definition threads.h:508
thread_wait_proc wait
Wait function to call to wait on the Condition.
Definition threads.h:507
uint32_t signature
Signature for entry validation.
Definition threads.h:503
LIST_HANDLE list
List of threads waiting on this CriticalSection (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:439
uint32_t state
State of the lock (Locked/Unlocked).
Definition threads.h:434
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when CriticalSection is destroyed.
Definition threads.h:443
thread_release_proc release
Release function to call if any threads are waiting when CriticalSection is unlocked.
Definition threads.h:442
uint32_t spincount
Number of times to spin wait for lock before Wait is called (Always 0 if SCHEDULER_CPU_COUNT = 1).
Definition threads.h:437
SPIN_HANDLE lock
Critical Section Lock.
Definition threads.h:438
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the CriticalSection if it is already locked.
Definition threads.h:441
uint32_t count
Count of lock recursions.
Definition threads.h:435
thread_wait_proc wait
Wait function to call to wait on the CriticalSection if it is already locked.
Definition threads.h:440
CRITICAL_SECTION_ENTRY * next
Next entry in CriticalSection table.
Definition threads.h:446
uint32_t signature
Signature for entry validation.
Definition threads.h:433
THREAD_HANDLE owner
Currently owning thread (or INVALID_HANDLE_VALUE if not locked).
Definition threads.h:436
CRITICAL_SECTION_ENTRY * prev
Previous entry in CriticalSection table.
Definition threads.h:445
LIST_HANDLE list
List of threads waiting on this Event (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:773
EVENT_ENTRY * prev
Previous entry in Event table.
Definition threads.h:779
uint32_t state
State of the event (Signaled/Unsignaled).
Definition threads.h:770
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when Event is destroyed.
Definition threads.h:777
thread_release_proc release
Release function to call if any threads are waiting when Event is Signaled.
Definition threads.h:776
SPIN_HANDLE lock
Event Lock.
Definition threads.h:772
uint32_t flags
Event Flags (eg EVENT_FLAG_MANUAL).
Definition threads.h:771
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Event if it is not Signaled.
Definition threads.h:775
EVENT_ENTRY * next
Next entry in Event table.
Definition threads.h:780
thread_wait_proc wait
Wait function to call to wait on the Event if it is not Signaled.
Definition threads.h:774
uint32_t signature
Signature for entry validation.
Definition threads.h:769
LIST_ELEMENT * prev
Previous element in List.
Definition threads.h:563
LIST_ELEMENT * next
Next element in List.
Definition threads.h:564
THREAD_HANDLE thread
The thread referenced by this List element.
Definition threads.h:562
LIST_ENTRY * prev
Previous entry in List table.
Definition threads.h:554
LIST_ELEMENT * last
Last element in List.
Definition threads.h:552
SPIN_HANDLE lock
List Lock.
Definition threads.h:550
uint32_t flags
List Flags (eg LIST_FLAG_IRQ).
Definition threads.h:549
LIST_ELEMENT * first
First element in List.
Definition threads.h:551
uint32_t count
Count of items currently in this List.
Definition threads.h:548
LIST_ENTRY * next
Next entry in List table.
Definition threads.h:555
uint32_t signature
Signature for entry validation.
Definition threads.h:546
uint32_t listtype
Type of this List (eg LIST_TYPE_WAIT_SECTION).
Definition threads.h:547
SEMAPHORE_HANDLE sender
Mailslot send Semaphore.
Definition threads.h:726
MAILSLOT_ENTRY * next
Next entry in Mailslot table.
Definition threads.h:731
ssize_t * messages
Mailslot message queue.
Definition threads.h:728
SPIN_HANDLE lock
Mailslot Lock.
Definition threads.h:725
uint32_t start
First message available in Mailslot.
Definition threads.h:724
MAILSLOT_ENTRY * prev
Previous entry in Mailslot table.
Definition threads.h:730
uint32_t count
Current number of messages in Mailslot.
Definition threads.h:723
SEMAPHORE_HANDLE receiver
Mailslot receive Semaphore.
Definition threads.h:727
uint32_t signature
Signature for entry validation.
Definition threads.h:721
uint32_t maximum
Maximum number of messages in Mailslot.
Definition threads.h:722
LIST_HANDLE list
List of threads waiting on this Messageslot (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:704
MESSAGE_LIST messages
Messageslot message queue.
Definition threads.h:705
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when Messageslot is destroyed.
Definition threads.h:709
thread_release_proc release
Release function to call if any threads are waiting when a message is sent.
Definition threads.h:708
SPIN_HANDLE lock
Messageslot Lock.
Definition threads.h:703
uint32_t flags
Messageslot Flags (eg MESSAGESLOT_FLAG_IRQ).
Definition threads.h:702
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Messageslot if there are no messages.
Definition threads.h:707
MESSAGESLOT_ENTRY * prev
Previous entry in Messageslot table.
Definition threads.h:711
thread_wait_proc wait
Wait function to call to wait on the Messageslot if there are no messages.
Definition threads.h:706
uint32_t signature
Signature for entry validation.
Definition threads.h:701
MESSAGESLOT_ENTRY * next
Next entry in Messageslot table.
Definition threads.h:712
THREAD_MESSAGE * list
Message list.
Definition threads.h:609
uint32_t start
First message available in list.
Definition threads.h:607
uint32_t count
Current number of messages in list.
Definition threads.h:606
uint32_t maximum
Maximum number of messages in list.
Definition threads.h:605
uint32_t state
State of the lock (Locked/Unlocked).
Definition threads.h:415
uint32_t spincount
Number of times to spin wait for lock before Yield is called (Always 0 if SCHEDULER_CPU_COUNT = 1).
Definition threads.h:420
uint32_t flags
Mutex Flags (eg MUTEX_FLAG_RECURSIVE).
Definition threads.h:419
uint32_t count
Count of lock recursions (only if Flags includes MUTEX_FLAG_RECURSIVE).
Definition threads.h:418
uint32_t signature
Signature for entry validation.
Definition threads.h:414
MUTEX_ENTRY * next
Next entry in Mutex table.
Definition threads.h:423
MUTEX_ENTRY * prev
Previous entry in Mutex table.
Definition threads.h:422
THREAD_HANDLE owner
Currently owning thread (or INVALID_HANDLE_VALUE if not locked).
Definition threads.h:416
thread_yield_proc yield
Yield function to call while waiting.
Definition threads.h:417
int key
Ordering key for Queue.
Definition threads.h:593
QUEUE_ELEMENT * prev
Previous element in Queue.
Definition threads.h:595
QUEUE_ELEMENT * next
Next element in Queue.
Definition threads.h:596
THREAD_HANDLE thread
The thread referenced by this Queue element.
Definition threads.h:594
QUEUE_ENTRY * next
Next entry in Queue table.
Definition threads.h:586
QUEUE_ENTRY * prev
Previous entry in Queue table.
Definition threads.h:585
QUEUE_ELEMENT * first
First element in Queue.
Definition threads.h:582
SPIN_HANDLE lock
Queue Lock.
Definition threads.h:581
uint32_t queuetype
Type of this Queue (eg QUEUE_TYPE_SCHEDULE_IDLE).
Definition threads.h:578
uint32_t flags
Queue Flags (eg QUEUE_FLAG_IRQ).
Definition threads.h:580
uint32_t count
Count of items currently in this Queue.
Definition threads.h:579
QUEUE_ELEMENT * last
Last element in Queue.
Definition threads.h:583
uint32_t signature
Signature for entry validation.
Definition threads.h:577
LIST_HANDLE list
List of threads waiting on this Semaphore (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:461
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when SemaphoreSignal is destroyed.
Definition threads.h:465
thread_release_proc release
Release function to call if any threads are waiting on SemaphoreSignal.
Definition threads.h:464
SPIN_HANDLE lock
Semaphore Lock.
Definition threads.h:460
uint32_t flags
Semaphore Flags (eg SEMAPHORE_FLAG_IRQ).
Definition threads.h:459
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Semaphore if the count is equal to zero on Semaphor...
Definition threads.h:463
uint32_t count
Count for this Semaphore (Can be negative when Threads are waiting).
Definition threads.h:457
SEMAPHORE_ENTRY * prev
Previous entry in Semaphore table.
Definition threads.h:467
thread_wait_proc wait
Wait function to call to wait on the Semaphore if the count is equal to zero on SemaphoreWait.
Definition threads.h:462
uint32_t signature
Signature for entry validation.
Definition threads.h:456
uint32_t maximum
Maximum count for this Semaphore.
Definition threads.h:458
SEMAPHORE_ENTRY * next
Next entry in Semaphore table.
Definition threads.h:468
SPIN_ENTRY * next
Next entry in Spin table.
Definition threads.h:404
uint32_t state
State of the lock (Locked/Unlocked).
Definition threads.h:399
SPIN_ENTRY * prev
Previous entry in Spin table.
Definition threads.h:403
uint32_t signature
Signature for entry validation.
Definition threads.h:398
uint32_t mask
IRQ/FIQ Mask for Save/Restore.
Definition threads.h:400
THREAD_HANDLE owner
Currently owning thread (or INVALID_HANDLE_VALUE if not locked).
Definition threads.h:401
LIST_HANDLE readerlist
List of reader threads waiting on this Synchronizer (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:485
uint32_t state
State of the lock (Locked/Unlocked).
Definition threads.h:479
SYNCHRONIZER_ENTRY * prev
Previous entry in Synchronizer table.
Definition threads.h:492
thread_abandon_proc abandon
Abandon function to call if any threads are waiting when Synchronizer is destroyed.
Definition threads.h:490
thread_release_proc release
Release function to call if any threads are waiting when Synchronizer is unlocked.
Definition threads.h:489
THREAD_HANDLE readerlast
Last thread to acquire reader lock (or INVALID_HANDLE_VALUE if no reader).
Definition threads.h:483
SPIN_HANDLE lock
Synchronizer Lock.
Definition threads.h:480
uint32_t writercount
Count of current writer lock recursions.
Definition threads.h:482
thread_wait_ex_proc waitex
Wait function to call to wait with timeout on the Synchronizer if it is already locked.
Definition threads.h:488
LIST_HANDLE writerlist
List of writer threads waiting on this Synchronizer (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:486
SYNCHRONIZER_ENTRY * next
Next entry in Synchronizer table.
Definition threads.h:493
THREAD_HANDLE writerowner
Currently owning writer thread (or INVALID_HANDLE_VALUE if no writer).
Definition threads.h:484
thread_wait_proc wait
Wait function to call to wait on the Synchronizer if it is already locked.
Definition threads.h:487
uint32_t readercount
Count of current reader locks.
Definition threads.h:481
uint32_t signature
Signature for entry validation.
Definition threads.h:478
SPIN_HANDLE lock
Tasker list Lock.
Definition threads.h:850
uint32_t count
Count of tasks currently in the Tasker list.
Definition threads.h:849
TASKER_TASK * first
First task in Tasker list.
Definition threads.h:851
TASKER_TASK * last
Last task in Tasker list.
Definition threads.h:852
THREAD_MESSAGE message
Message to be sent.
Definition threads.h:886
MESSAGESLOT_HANDLE messageslot
Handle of the message slot to send to.
Definition threads.h:885
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:883
uint32_t task
The task to be performed.
Definition threads.h:881
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:882
COMPLETION_HANDLE completion
Handle of the completion to complete or complete all.
Definition threads.h:920
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:918
uint32_t task
The task to be performed.
Definition threads.h:916
LONGBOOL all
False for complete, True for complete all.
Definition threads.h:921
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:917
COMPLETION_HANDLE completion
Handle of the completion to reset.
Definition threads.h:909
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:907
uint32_t task
The task to be performed.
Definition threads.h:905
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:906
SEMAPHORE_HANDLE semaphore
Handle of the semaphore to signal.
Definition threads.h:897
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:895
uint32_t count
The count to be signalled.
Definition threads.h:898
uint32_t task
The task to be performed.
Definition threads.h:893
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:894
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:862
uint32_t task
The task to be performed.
Definition threads.h:860
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:861
THREAD_MESSAGE message
Message to send to the thread.
Definition threads.h:874
TASKER_TASK * next
Next task in Tasker list.
Definition threads.h:871
uint32_t task
The task to be performed.
Definition threads.h:869
THREAD_HANDLE thread
Handle of the thread to send a message to.
Definition threads.h:873
TASKER_TASK * prev
Previous task in Tasker list.
Definition threads.h:870
THREAD_ENTRY * next
Next entry in Thread table.
Definition threads.h:659
uint32_t affinity
CPU Affinity mask of the Thread.
Definition threads.h:632
void * tlstable[THREAD_TLS_MAXIMUM]
Thread Local Storage Index Pointers (for ThreadGetTlsValue/ThreadSetTlsValue) //To Do //Test.
Definition threads.h:640
LIST_HANDLE list
List of threads waiting on this thread (or INVALID_HANDLE_VALUE if never used).
Definition threads.h:650
THREAD_HANDLE parent
Handle of the parent thread.
Definition threads.h:637
uint32_t state
State of the Thread (eg THREAD_STATE_RUNNING).
Definition threads.h:629
MESSAGE_LIST messages
Messages sent to this thread.
Definition threads.h:638
uint32_t lasterror
Thread Last Error.
Definition threads.h:643
int64_t kerneltime
The total amount of time this thread has been in the running state (ie CPU time consumed).
Definition threads.h:663
uint32_t tlsflags[THREAD_TLS_MAXIMUM]
Thread Local Storage Index Flags (eg THREAD_TLS_FLAG_FREE).
Definition threads.h:641
SPIN_HANDLE lock
Thread Lock.
Definition threads.h:636
LIST_HANDLE waitlist
The wait list this thread is currently in (or INVALID_HANDLE_VALUE).
Definition threads.h:651
char name[THREAD_NAME_LENGTH]
The name of the Thread.
Definition threads.h:635
QUEUE_ELEMENT queueelement
Queue element for this thread when in a Schedule Queue.
Definition threads.h:657
uint32_t flags
Flags of the Thread (eg THREAD_FLAG_PERSIST).
Definition threads.h:630
void * stackbase
Base (Top) of the thread stack.
Definition threads.h:633
void * stackpointer
Saved current stack pointer from last ContextSwitch.
Definition threads.h:647
uint32_t priority
Priority of the Thread (eg THREAD_PRIORITY_NORMAL).
Definition threads.h:631
int64_t createtime
The time when this thread was created.
Definition threads.h:661
uint32_t stacksize
Stack length in bytes.
Definition threads.h:634
uint32_t exitcode
Thread Exit Code.
Definition threads.h:642
int64_t exittime
The time when this thread exited or was terminated.
Definition threads.h:662
int64_t switchcount
The number of times this thread has been selected to run by a context switch.
Definition threads.h:664
LIST_HANDLES * waitlists
The wait lists this thread is currently in if doing a multiple wait (or nil).
Definition threads.h:652
LCID locale
Thread Locale.
Definition threads.h:644
LIST_ELEMENT listelement
List element for this thread when in a Wait List.
Definition threads.h:656
uint32_t receiveresult
The result code for the last receive with timeout (eg WAIT_TIMEOUT).
Definition threads.h:654
uint32_t signature
Signature for entry validation.
Definition threads.h:628
uint32_t targetpriority
Target Priority of the Thread for next ContextSwitch (eg THREAD_PRIORITY_NORMAL).
Definition threads.h:649
uint32_t targetcpu
Target CPU of the Thread for next ContextSwitch.
Definition threads.h:648
THREAD_ENTRY * prev
Previous entry in Thread table.
Definition threads.h:658
void * tlspointer
Thread Local Storage Memory (RTL ThreadVars).
Definition threads.h:639
QUEUE_HANDLE schedulequeue
The scheduler queue this thread is currently in (or INVALID_HANDLE_VALUE).
Definition threads.h:655
uint32_t currentcpu
Saved current CPU from last ContextSwitch.
Definition threads.h:646
uint32_t waitresult
The result code for the last wait with timeout (eg WAIT_TIMEOUT).
Definition threads.h:653
size_t wparam
Definition threads.h:617
ssize_t lparam
Definition threads.h:618
size_t msg
Definition threads.h:616
uint32_t time
Definition threads.h:619
uint32_t affinity
CPU Affinity mask of the Thread.
Definition threads.h:677
THREAD_HANDLE parent
Handle of the parent thread.
Definition threads.h:682
uint32_t state
State of the Thread (eg THREAD_STATE_RUNNING).
Definition threads.h:673
uint32_t lasterror
Thread Last Error.
Definition threads.h:684
int64_t kerneltime
The total amount of time this thread has been in the running state (ie CPU time consumed).
Definition threads.h:690
uint32_t cpu
CPU from last ContextSwitch.
Definition threads.h:675
THREAD_HANDLE handle
Handle of the thread.
Definition threads.h:672
char name[THREAD_NAME_LENGTH]
The name of the Thread.
Definition threads.h:681
uint32_t flags
Flags of the Thread (eg THREAD_FLAG_PERSIST).
Definition threads.h:674
void * stackbase
Base (Top) of the thread stack.
Definition threads.h:678
void * stackpointer
Stack pointer from last ContextSwitch.
Definition threads.h:680
uint32_t priority
Priority of the Thread (eg THREAD_PRIORITY_NORMAL).
Definition threads.h:676
int64_t createtime
The time when this thread was created.
Definition threads.h:688
THREAD_SNAPSHOT * next
Next entry in Thread snapshot.
Definition threads.h:693
uint32_t stacksize
Stack length in bytes.
Definition threads.h:679
uint32_t exitcode
Thread Exit Code.
Definition threads.h:683
int64_t exittime
The time when this thread exited or was terminated.
Definition threads.h:689
int64_t switchcount
The number of times this thread has been selected to run by a context switch.
Definition threads.h:691
LCID locale
Thread Locale.
Definition threads.h:685
uint32_t targetpriority
Target Priority of the Thread for next ContextSwitch (eg THREAD_PRIORITY_NORMAL).
Definition threads.h:687
uint32_t targetcpu
Target CPU of the Thread for next ContextSwitch.
Definition threads.h:686
TIMER_ENTRY * prev
Previous entry in Timer table.
Definition threads.h:823
uint32_t state
State of the timer (Enabled/Disabled).
Definition threads.h:815
TIMER_ITEM timeritem
Timer list item for this timer when in a Timer list.
Definition threads.h:822
SPIN_HANDLE lock
Timer Lock.
Definition threads.h:817
TIMER_LIST * timerlist
The timer list this timer is currently in (or nil).
Definition threads.h:821
void * data
Data to pass to function when timer triggers.
Definition threads.h:819
uint32_t flags
Timer Flags (eg TIMER_FLAG_RESCHEDULE).
Definition threads.h:816
timer_event_proc event
Function to call when timer triggers.
Definition threads.h:818
uint32_t signature
Signature for entry validation.
Definition threads.h:813
uint32_t interval
Interval for timer (Milliseconds).
Definition threads.h:814
TIMER_ENTRY * next
Next entry in Timer table.
Definition threads.h:824
int key
Ordering key for Timer list.
Definition threads.h:802
TIMER_ITEM * next
Next item in Timer list.
Definition threads.h:805
TIMER_ITEM * prev
Previous item in Timer list.
Definition threads.h:804
TIMER_HANDLE timer
The timer referenced by this Timer list item.
Definition threads.h:803
TIMER_ITEM * last
Last item in Timer list.
Definition threads.h:794
SPIN_HANDLE lock
Timer list Lock.
Definition threads.h:792
uint32_t flags
Timer list Flags (eg LOCK_FLAG_IRQ).
Definition threads.h:791
TIMER_ITEM * first
First item in Timer list.
Definition threads.h:793
uint32_t count
Count of items currently in the Timer list.
Definition threads.h:790
worker_task_proc task
Task to call by worker.
Definition threads.h:838
SPIN_HANDLE lock
Worker Lock (or INVALID_HANDLE_VALUE if Interval is 0 and Flags is not WORKER_FLAG_RESCHEDULE).
Definition threads.h:836
void * data
Data to pass to task.
Definition threads.h:839
uint32_t flags
Worker Flags (eg WORKER_FLAG_RESCHEDULE).
Definition threads.h:835
worker_cb callback
Callback when task is completed.
Definition threads.h:840
uint32_t signature
Signature for entry validation.
Definition threads.h:833
uint32_t interval
Interval for worker (Milliseconds).
Definition threads.h:834
TIMER_HANDLE timer
Worker Timer (or INVALID_HANDLE_VALUE if Interval is 0).
Definition threads.h:837
ssize_t STDCALL(* thread_func)(void *parameter)
Thread function prototype.
Definition system.h:62
HANDLE THREAD_ID
Type for Thread-IDs.
Definition system.h:63
uint32_t STDCALL semaphore_destroy(SEMAPHORE_HANDLE semaphore)
Destroy and remove an existing Semaphore entry.
void *STDCALL buffer_iterate(BUFFER_HANDLE buffer, void *previous)
Iterate through each of the buffers in an existing Buffer entry.
uint32_t STDCALL messageslot_send(MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
Send a message to a Messageslot.
void *STDCALL thread_setup_stack(void *stackbase, thread_start_proc startproc, thread_end_proc returnproc, void *parameter)
uint32_t STDCALL thread_wait_message(void)
Make the current thread wait until a message is received (indefinitely).
#define SCHEDULER_QUANTUM_IDLE
Definition threads.h:370
uint32_t STDCALL completion_state(COMPLETION_HANDLE completion)
Get the current state of an existing Completion entry.
uint32_t STDCALL timer_get_list_flags(void)
Get the lock flags for the timer list.
struct _SYNCHRONIZER_ENTRY SYNCHRONIZER_ENTRY
Definition threads.h:474
uint32_t STDCALL thread_destroy(THREAD_HANDLE thread)
Destroy and remove an existing Thread entry.
uint32_t STDCALL scheduler_get_thread_preempt(uint32_t cpuid)
Get the current thread preempt setting for the specified CPU.
uint32_t STDCALL timer_trigger(void)
Remove all entries from the timer list that have reached their interval.
uint32_t STDCALL spin_unlock(SPIN_HANDLE spin)
Unlock an existing Spin entry.
uint32_t STDCALL thread_get_affinity(THREAD_HANDLE thread)
Get the scheduling affinity of a Thread.
uint32_t STDCALL event_wait(EVENT_HANDLE event)
Wait on an existing Event entry.
THREAD_HANDLE STDCALL scheduler_switch(uint32_t cpuid, THREAD_HANDLE thread)
Perform a preemptive thread switch operation under an interrupt handler.
void *STDCALL thread_get_tls_value(uint32_t tlsindex)
Get the pointer associated with the TLS index for the current thread.
SYNCHRONIZER_HANDLE STDCALL synchronizer_create_ex(BOOL initialreader, BOOL initialwriter)
Create and insert a new Synchronizer entry.
int STDCALL queue_increment_key(QUEUE_HANDLE queue)
Increment the first Key value in the Queue.
uint32_t STDCALL synchronizer_writer_convert(SYNCHRONIZER_HANDLE synchronizer)
Convert a writer lock on an existing Synchronizer entry to a reader lock.
uint32_t STDCALL queue_lock(QUEUE_HANDLE queue)
Lock the supplied Queue.
uint32_t STDCALL thread_get_last_error(void)
Get the last error value for the current Thread.
uint32_t STDCALL timer_check(void)
Check if the timer list is empty, if not then decrement the first key.
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 buffer_count(BUFFER_HANDLE buffer)
Get the total count of buffers in an existing Buffer entry.
uint32_t STDCALL tasker_trigger(void)
Dequeue all tasks in the tasker list and perform the requested task for each.
uint32_t STDCALL mailslot_get_count(void)
Get the current mailslot count.
struct _WORKER_REQUEST WORKER_REQUEST
Definition threads.h:829
struct _TASKER_SEMAPHORE_RESET TASKER_SEMAPHORE_RESET
Definition threads.h:902
struct _BUFFER_ITEM BUFFER_ITEM
Definition threads.h:736
THREAD_HANDLE STDCALL synchronizer_reader_last(SYNCHRONIZER_HANDLE synchronizer)
Get the last reader thread of an existing Synchronizer entry.
uint32_t STDCALL thread_get_flags(THREAD_HANDLE thread)
Get the current flags of a thread.
uint32_t STDCALL thread_release(LIST_HANDLE list)
Release the first thread waiting on the supplied list.
BUFFER_HANDLE STDCALL buffer_create_ex(uint32_t size, uint32_t count, uint32_t flags)
Create and insert a new Buffer entry.
struct _THREAD_MESSAGE THREAD_MESSAGE
Definition threads.h:600
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.
struct _CRITICAL_SECTION_ENTRY CRITICAL_SECTION_ENTRY
Definition threads.h:429
struct _COMPLETION_ENTRY COMPLETION_ENTRY
Definition threads.h:519
uint32_t STDCALL messageslot_destroy(MESSAGESLOT_HANDLE messageslot)
Destroy and remove an existing Messageslot entry.
uint32_t STDCALL condition_get_count(void)
Get the current condition count.
#define SCHEDULER_MASK_CRITICAL
Definition threads.h:356
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).
int STDCALL queue_last_key(QUEUE_HANDLE queue)
Get the last Key value from the Queue.
uint32_t STDCALL mutex_count(MUTEX_HANDLE mutex)
Get the current lock count of an existing Mutex entry.
uint32_t STDCALL thread_get_name(THREAD_HANDLE thread, char *name, uint32_t len)
Get the name of a Thread.
struct _MUTEX_ENTRY MUTEX_ENTRY
Definition threads.h:410
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.
#define SCHEDULER_QUANTUM_HIGHER
Definition threads.h:374
uint32_t STDCALL spin_unlock_irq(SPIN_HANDLE spin)
Unlock an existing Spin entry and restore the previous IRQ state.
uint32_t STDCALL mutex_lock(MUTEX_HANDLE mutex)
Lock an existing Mutex entry.
uint32_t STDCALL thread_suspend(THREAD_HANDLE thread)
Suspend a thread, placing it in hibernation.
uint32_t STDCALL scheduler_preempt_enable(uint32_t cpuid)
Enable thread preemption for the specified CPU.
uint32_t STDCALL completion_get_count(void)
Get the current completion count.
struct _TIMER_ITEM TIMER_ITEM
Definition threads.h:785
#define SCHEDULER_MASK_IDLE
Definition threads.h:350
uint32_t STDCALL timer_enable(TIMER_HANDLE timer)
Enable an existing Timer entry (Timer events will be generated).
struct _THREAD_ENTRY THREAD_ENTRY
Definition threads.h:624
struct _TASKER_MESSAGESLOT_SEND TASKER_MESSAGESLOT_SEND
Definition threads.h:878
uint32_t STDCALL timer_get_messageslot_flags(void)
Get the lock flags for the timer messageslot.
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.
#define THREAD_TLS_MAXIMUM
The maximum number TLS index slots available.
Definition threads.h:251
uint32_t STDCALL thread_get_count(void)
Get the current thread count.
MUTEX_HANDLE STDCALL mutex_create_ex(BOOL initialowner, uint32_t spincount, uint32_t flags)
Create and insert a new Mutex entry.
uint32_t STDCALL thread_get_priority(THREAD_HANDLE thread)
Get the scheduling priority of a Thread.
uint32_t STDCALL messageslot_count(MESSAGESLOT_HANDLE messageslot)
Get the number of available messages in a Messageslot entry.
uint32_t STDCALL event_pulse(EVENT_HANDLE event)
Pulse (Set then Reset) an existing Event entry.
uint32_t STDCALL buffer_free(void *buffer)
Release a allocated buffer from an existing Buffer entry.
uint32_t STDCALL semaphore_get_count(void)
Get the current semaphore count.
struct _TASKER_TASK TASKER_TASK
Definition threads.h:844
uint32_t STDCALL condition_destroy(CONDITION_HANDLE condition)
Destroy and remove an existing Condition entry.
uint32_t STDCALL scheduler_get_queue_flags(uint32_t queuetype)
Get the queue flags for the specified type of scheduler queue.
uint32_t STDCALL thread_get_wait_result(void)
Get the result of the last wait timeout for the current 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.
uint32_t STDCALL thread_set_tls_pointer(THREAD_HANDLE thread, void *tlspointer)
Set the RTL TLS (Thread Local Storage) pointer of a Thread.
CRITICAL_SECTION_HANDLE STDCALL critical_section_create_ex(BOOL initialowner, uint32_t spincount)
Create and insert a new CriticalSection entry.
uint32_t STDCALL thread_set_affinity(THREAD_HANDLE thread, uint32_t affinity)
Set the scheduling affinity of a Thread.
uint32_t STDCALL scheduler_get_thread_allocation(uint32_t cpuid)
Get the current thread allocation setting for the specified CPU.
LIST_ELEMENT *STDCALL list_get_thread(LIST_HANDLE list, THREAD_HANDLE thread)
Find the supplied thread in the List and return its element.
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.
uint32_t STDCALL mailslot_send_ex(MAILSLOT_HANDLE mailslot, ssize_t data, uint32_t timeout)
Send a message to a Mailslot.
uint32_t STDCALL thread_state_to_string(uint32_t threadstate, char *string, uint32_t len)
MUTEX_HANDLE STDCALL mutex_create(void)
Create and insert a new Mutex entry.
uint32_t STDCALL thread_alloc_tls_index_ex(uint32_t flags)
Allocate a TLS index in the TLS index table.
uint32_t STDCALL mutex_destroy(MUTEX_HANDLE mutex)
Destroy and remove an existing Mutex entry.
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 worker_cancel(WORKER_HANDLE worker)
Cancel a previously scheduled worker thread task.
SPIN_HANDLE STDCALL spin_create_ex(BOOL initialowner)
Create and insert a new Spin entry.
uint32_t STDCALL list_unlock(LIST_HANDLE list)
Unlock the supplied List.
struct _BUFFER_ENTRY BUFFER_ENTRY
Definition threads.h:737
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.
EVENT_HANDLE STDCALL event_create_ex(uint32_t flags)
Create and insert a new Event entry.
uint32_t STDCALL thread_release_tls_index(uint32_t tlsindex)
Deallocate a TLS index from the TLS index table.
uint32_t STDCALL scheduler_migration_disable(void)
Disable scheduler thread migration.
struct _MAILSLOT_ENTRY MAILSLOT_ENTRY
Definition threads.h:717
uint32_t STDCALL scheduler_get_migration_quantum(void)
Get the current migration quantum.
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(SPIN_HANDLE spin)
Lock an existing Spin entry, disable IRQ and save the previous IRQ state.
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 synchronizer_destroy(SYNCHRONIZER_HANDLE synchronizer)
Destroy and remove an existing Synchronizer entry.
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 timer_destroy(TIMER_HANDLE timer)
Destroy and remove an existing Timer entry.
uint32_t STDCALL thread_get_tls_index(uint32_t tlsindex)
Get the current status of a TLS index in the TLS index table.
LIST_HANDLE STDCALL list_create(void)
Create and insert a new List entry.
uint32_t STDCALL event_destroy(EVENT_HANDLE event)
Destroy and remove an existing Event entry.
uint32_t STDCALL thread_get_exit_code(THREAD_HANDLE thread)
Get the exit code of a Thread.
uint32_t STDCALL spin_get_count(void)
Get the current spin lock count.
uint32_t STDCALL list_lock(LIST_HANDLE list)
Lock the supplied List.
int STDCALL timer_decrement_key(void)
Decrement the first Key value in the Timer list.
COMPLETION_HANDLE STDCALL completion_create(uint32_t flags)
Create and insert a new Completion entry.
uint32_t STDCALL list_get_count(void)
Get the current list count.
uint32_t STDCALL scheduler_migration_enable(void)
Enable scheduler thread migration.
void *STDCALL buffer_get_ex(BUFFER_HANDLE buffer, uint32_t timeout)
Allocate an available buffer from an existing Buffer 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.
LCID STDCALL thread_get_locale(THREAD_HANDLE thread)
Get the current locale of a thread.
uint32_t STDCALL worker_decrease_ex(uint32_t count, BOOL priority)
Decrease the number of worker threads available.
uint32_t STDCALL event_state(EVENT_HANDLE event)
Get the current state of an existing Event entry.
uint32_t STDCALL scheduler_get_thread_count(uint32_t cpuid)
Get the thread count for the specified CPU.
CRITICAL_SECTION_HANDLE STDCALL critical_section_create(void)
Create and insert a new CriticalSection entry.
uint32_t STDCALL scheduler_allocation_disable(uint32_t cpuid)
Disable thread allocation for the specified CPU.
struct _MESSAGE_LIST MESSAGE_LIST
Definition threads.h:601
uint32_t STDCALL tasker_messageslot_send(MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
Perform a MessageslotSend() function call using the tasker list.
struct _SPIN_ENTRY SPIN_ENTRY
Definition threads.h:394
uint32_t STDCALL event_reset(EVENT_HANDLE event)
Reset (Unsignal) an existing Event entry.
uint32_t STDCALL critical_section_lock(CRITICAL_SECTION_HANDLE criticalsection)
Lock an existing CriticalSection entry.
uint32_t STDCALL thread_wake(THREAD_HANDLE thread)
Remove a thread prematurely from the sleep or timeout queues.
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.
uint32_t STDCALL queue_destroy(QUEUE_HANDLE queue)
Destroy and remove an existing Queue entry.
MAILSLOT_HANDLE STDCALL mailslot_create(uint32_t maximum)
Create and insert a new Mailslot entry.
uint32_t STDCALL completion_destroy(COMPLETION_HANDLE completion)
Destroy and remove an existing Completion entry.
uint32_t STDCALL thread_yield(void)
Make the current thread yield the processor (Same as ThreadSleep(0)).
uint32_t STDCALL scheduler_allocation_enable(uint32_t cpuid)
Enable thread allocation for the specified CPU.
int STDCALL queue_decrement_key(QUEUE_HANDLE queue)
Decrement the first Key value in the Queue.
uint32_t STDCALL mailslot_destroy(MAILSLOT_HANDLE mailslot)
Destroy and remove an existing Mailslot entry.
uint32_t STDCALL thread_lock(THREAD_HANDLE thread)
Lock a thread allowing access to internal structures such as the thread stack.
struct _TASKER_SEMAPHORE_COMPLETE TASKER_SEMAPHORE_COMPLETE
Definition threads.h:913
struct _TIMER_ENTRY TIMER_ENTRY
Definition threads.h:809
uint32_t STDCALL synchronizer_writer_unlock(SYNCHRONIZER_HANDLE synchronizer)
Unlock an existing Synchronizer entry.
uint32_t STDCALL semaphore_signal(SEMAPHORE_HANDLE semaphore)
Signal an existing Semaphore entry.
struct _MESSAGESLOT_ENTRY MESSAGESLOT_ENTRY
Definition threads.h:697
uint32_t STDCALL thread_send_message(THREAD_HANDLE thread, THREAD_MESSAGE *message)
Send a message to another thread.
BOOL STDCALL queue_is_empty(QUEUE_HANDLE queue)
Check if the supplied Queue is empty.
uint32_t STDCALL worker_increase_ex(uint32_t count, BOOL priority)
Increase the number of worker threads available.
uint32_t STDCALL timer_get_count(void)
Get the current timer count.
#define THREAD_PRIORITY_COUNT
Number of thread priority levels.
Definition threads.h:215
uint32_t STDCALL thread_wait_terminate(THREAD_HANDLE thread, uint32_t timeout)
Make the current thread wait until the specified thread has terminated.
void STDCALL thread_set_last_error(uint32_t lasterror)
Set the last error value for the current Thread.
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.
uint32_t STDCALL queue_unlock(QUEUE_HANDLE queue)
Unlock the supplied Queue.
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 thread_set_locale(THREAD_HANDLE thread, LCID locale)
Set the locale of a thread.
uint32_t STDCALL semaphore_signal_ex(SEMAPHORE_HANDLE semaphore, uint32_t count, uint32_t *previous)
Signal an existing Semaphore entry one or more times.
CONDITION_HANDLE STDCALL condition_create(void)
Create and insert a new Condition entry.
uint32_t STDCALL scheduler_get_thread_migration(void)
Get the current thread migration setting.
uint32_t STDCALL thread_set_current(THREAD_HANDLE thread)
Set the Handle of currently executing thread.
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.
LIST_HANDLE STDCALL list_create_ex(uint32_t listtype, uint32_t flags)
Create and insert a new List entry.
BUFFER_HANDLE STDCALL buffer_create(uint32_t size, uint32_t count)
Create and insert a new Buffer entry.
struct _TASKER_LIST TASKER_LIST
Definition threads.h:845
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_get_stack_free(void)
Get the free stack size of the current thread.
#define SCHEDULER_MASK_LOWEST
Definition threads.h:351
uint32_t STDCALL thread_abandon_message(THREAD_HANDLE thread)
Tell another thread to abandon waiting for a message.
TIMER_HANDLE STDCALL timer_dequeue(void)
Get and remove the first timer from the Timer list.
LIST_ELEMENT *STDCALL list_get_last_ex(LIST_HANDLE list, BOOL remove)
Get the last element from the List.
uint32_t STDCALL thread_type_to_string(uint32_t threadtype, char *string, uint32_t len)
uint32_t STDCALL thread_migrate(THREAD_HANDLE thread, uint32_t cpu)
Migrate a thread to a new CPU.
THREAD_HANDLE STDCALL mutex_owner(MUTEX_HANDLE mutex)
Get the current owner of an existing Mutex entry.
uint32_t STDCALL list_remove(LIST_HANDLE list, LIST_ELEMENT *element)
Remove an element from the List.
THREAD_SNAPSHOT *STDCALL thread_snapshot_create(void)
void STDCALL thread_release_stack(void *stackbase, uint32_t stacksize)
Release a thread stack allocated with ThreadAllocateStack.
LIST_ELEMENT *STDCALL list_get_first(LIST_HANDLE list)
Get the first element from the List.
uint32_t STDCALL list_type_to_string(uint32_t listtype, char *string, uint32_t len)
uint32_t STDCALL thread_get_receive_result(void)
Get the result of the last receive timeout for the current Thread.
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 synchronizer_reader_count(SYNCHRONIZER_HANDLE synchronizer)
Get the current reader count of an existing Synchronizer entry.
uint32_t STDCALL spin_destroy(SPIN_HANDLE spin)
Destroy and remove an existing Spin entry.
uint32_t STDCALL thread_alloc_tls_index(void)
Allocate a TLS index in the TLS index table.
uint32_t STDCALL completion_try_wait(COMPLETION_HANDLE completion)
Try an existing Completion to see if it is completed.
#define SCHEDULER_QUANTUM_NORMAL
Definition threads.h:373
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 scheduler_get_priority_quantum(uint32_t priority)
Get the scheduler quantum for the specified thread priority.
uint32_t STDCALL condition_wake_all(CONDITION_HANDLE condition)
Wake all threads waiting on an existing Condition.
uint32_t STDCALL buffer_available(BUFFER_HANDLE buffer)
Get the available count of buffers in an existing Buffer entry.
#define SCHEDULER_MASK_NONE
Definition threads.h:349
#define SCHEDULER_QUANTUM_HIGHEST
Definition threads.h:375
LIST_HANDLE LIST_HANDLES[THREAD_LISTS_MAXIMUM]
Definition threads.h:568
#define THREAD_LISTS_MAXIMUM
Maximum number of lists a thread can wait on at the same time.
Definition threads.h:258
uint32_t STDCALL list_add_last(LIST_HANDLE list, LIST_ELEMENT *element)
Add the supplied element as the last item in the List.
uint32_t STDCALL synchronizer_writer_count(SYNCHRONIZER_HANDLE synchronizer)
Get the current writer count of an existing Synchronizer entry.
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 critical_section_get_count(void)
Get the current critical section count.
uint32_t STDCALL list_insert(LIST_HANDLE list, LIST_ELEMENT *previous, LIST_ELEMENT *element)
Insert a new element in the List.
#define SCHEDULER_QUANTUM_NONE
Definition threads.h:369
uint32_t STDCALL mutex_get_count(void)
Get the current mutex count.
uint32_t STDCALL spin_exchange_irq(SPIN_HANDLE spin1, SPIN_HANDLE spin2)
Exchange the previous IRQ state between two Spin entries.
uint32_t STDCALL semaphore_count(SEMAPHORE_HANDLE semaphore)
Get the current count of an existing Semaphore entry.
void *STDCALL thread_allocate_stack(uint32_t stacksize)
Allocate memory for a new thread stack.
uint32_t STDCALL synchronizer_reader_unlock(SYNCHRONIZER_HANDLE synchronizer)
Unlock an existing Synchronizer entry.
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 completion_complete(COMPLETION_HANDLE completion)
Set (complete) the state of an existing Completion entry.
uint32_t STDCALL synchronizer_reader_lock_ex(SYNCHRONIZER_HANDLE synchronizer, uint32_t timeout)
Lock an existing Synchronizer entry for reading.
#define SCHEDULER_MASK_NORMAL
Definition threads.h:353
uint32_t STDCALL worker_increase(uint32_t count)
Increase the number of worker threads available.
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 scheduler_preempt_to_string(uint32_t preempt, char *string, uint32_t len)
uint32_t STDCALL event_wait_ex(EVENT_HANDLE event, uint32_t timeout)
Wait on an existing Event entry.
THREAD_HANDLE STDCALL queue_dequeue(QUEUE_HANDLE queue)
Get and remove the first thread from the Queue.
uint32_t STDCALL event_get_count(void)
Get the current event count.
uint32_t STDCALL tasker_check(void)
Check if the tasker list is empty or contains tasks.
uint32_t STDCALL thread_set_priority(THREAD_HANDLE thread, uint32_t priority)
Set the scheduling priority of a Thread.
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 thread_set_stack_base(THREAD_HANDLE thread, size_t stackbase)
Set the current stack base of a thread.
EVENT_HANDLE STDCALL event_create(BOOL manualreset, BOOL initialstate)
Create and insert a new Event entry.
uint32_t STDCALL list_destroy(LIST_HANDLE list)
Destroy and remove an existing List entry.
#define SCHEDULER_QUANTUM_CRITICAL
Definition threads.h:376
uint32_t STDCALL scheduler_expire(uint32_t cpuid)
Remove all threads from the timeout queue that have no more time to wait.
#define SCHEDULER_MASK_LOWER
Definition threads.h:352
uint32_t STDCALL condition_wake(CONDITION_HANDLE condition)
Wake one thread waiting on an existing Condition.
struct _QUEUE_ELEMENT QUEUE_ELEMENT
Definition threads.h:572
uint32_t STDCALL thread_set_flags(THREAD_HANDLE thread, uint32_t flags)
Set the current flags of a thread.
uint32_t STDCALL synchronizer_get_count(void)
Get the current synchronizer count.
ssize_t STDCALL mailslot_receive(MAILSLOT_HANDLE mailslot)
Receive a message from a Mailslot.
uint32_t STDCALL semaphore_wait_ex(SEMAPHORE_HANDLE semaphore, uint32_t timeout)
Wait on an existing Semaphore entry.
uint32_t STDCALL completion_wait(COMPLETION_HANDLE completion, uint32_t timeout)
Wait on an existing Completion.
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.
SYNCHRONIZER_HANDLE STDCALL synchronizer_create(void)
Create and insert a new Synchronizer entry.
uint32_t STDCALL scheduler_get_starvation_quantum(uint32_t cpuid)
Get the current starvation quantum for the specified CPU.
uint32_t STDCALL worker_decrease(uint32_t count)
Decrease the number of worker threads available.
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 queue_count(QUEUE_HANDLE queue)
Get the current count from the supplied queue.
uint32_t STDCALL worker_get_messageslot_flags(void)
Get the lock flags for the worker messageslot.
uint32_t STDCALL spin_unlock_preempt(SPIN_HANDLE spin)
Unlock an existing Spin entry and restore the previous IRQ or IRQ/FIQ state.
void *STDCALL thread_get_tls_pointer(THREAD_HANDLE thread)
Get the RTL TLS (Thread Local Storage) pointer of a Thread.
size_t STDCALL thread_get_stack_base(THREAD_HANDLE thread)
Get the current stack base of a thread.
uint32_t STDCALL spin_lock(SPIN_HANDLE spin)
Lock an existing Spin entry.
uint32_t STDCALL messageslot_get_count(void)
Get the current messageslot count.
uint32_t STDCALL tasker_enqueue(TASKER_TASK *task)
Add the supplied task to the end of the Tasker list.
BOOL STDCALL timer_not_empty(void)
Check if the Timer list is not empty.
uint32_t STDCALL completion_complete_all(COMPLETION_HANDLE completion)
Set (complete) the state of an existing Completion entry.
uint32_t STDCALL mutex_try_lock(MUTEX_HANDLE mutex)
Try to lock an existing Mutex entry.
uint32_t STDCALL buffer_get_count(void)
Get the current buffer count.
uint32_t STDCALL mailslot_count(MAILSLOT_HANDLE mailslot)
Get the number of available messages in a Mailslot entry.
uint32_t STDCALL timer_delete_key(TIMER_HANDLE timer)
Delete the supplied timer from the Timer list.
uint32_t STDCALL list_count(LIST_HANDLE list)
Get the current count from the supplied list.
uint32_t STDCALL thread_resume(THREAD_HANDLE thread)
Resume a suspended thread, making it ready.
uint32_t STDCALL completion_reset(COMPLETION_HANDLE completion)
Reset (uncomplete) the state of an existing Completion entry.
uint32_t STDCALL scheduler_migration_to_string(uint32_t migration, char *string, uint32_t len)
uint32_t STDCALL critical_section_destroy(CRITICAL_SECTION_HANDLE criticalsection)
Destroy and remove an existing CriticalSection entry.
uint32_t STDCALL mutex_unlock(MUTEX_HANDLE mutex)
Unlock an existing Mutex entry.
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 condition_wait(CONDITION_HANDLE condition, uint32_t timeout)
Wait on an existing Condition.
struct _TASKER_THREAD_SEND_MESSAGE TASKER_THREAD_SEND_MESSAGE
Definition threads.h:866
uint32_t STDCALL scheduler_get_thread_next(void)
Get the next CPU for thread allocation.
BOOL STDCALL list_is_empty(LIST_HANDLE list)
Check if the supplied List is empty.
BOOL STDCALL queue_not_empty(QUEUE_HANDLE queue)
Check if the supplied Queue is not empty.
uint32_t STDCALL thread_add_flags(THREAD_HANDLE thread, uint32_t flags)
Add flags to the current flags of a thread.
uint32_t STDCALL queue_enqueue(QUEUE_HANDLE queue, THREAD_HANDLE thread)
Add the supplied thread as the last item in the Queue.
uint32_t STDCALL queue_type_to_string(uint32_t queuetype, char *string, uint32_t len)
uint32_t STDCALL thread_set_tls_value(uint32_t tlsindex, void *tlsvalue)
Set the pointer associated with the TLS index for the current thread.
MESSAGESLOT_HANDLE STDCALL messageslot_create(void)
Create and insert a new Messageslot entry.
uint32_t STDCALL scheduler_get_priority_mask(uint32_t cpuid)
Get the current priority mask for the specified CPU.
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.
#define SCHEDULER_MASK_HIGHEST
Definition threads.h:355
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 critical_section_count(CRITICAL_SECTION_HANDLE criticalsection)
Get the current lock count of an existing CriticalSection entry.
uint32_t STDCALL scheduler_reschedule(BOOL yield)
Perform a thread switch operation when a thread yields, sleeps or waits.
uint32_t STDCALL event_set(EVENT_HANDLE event)
Set (Signal) an existing Event entry.
struct _THREAD_SNAPSHOT THREAD_SNAPSHOT
Definition threads.h:668
struct _QUEUE_ENTRY QUEUE_ENTRY
Definition threads.h:573
uint32_t STDCALL tasker_completion_reset(COMPLETION_HANDLE completion)
Perform a CompletionReset() function call using the tasker list.
THREAD_HANDLE STDCALL thread_get_current(void)
Get the Handle of currently executing thread.
struct _TIMER_LIST TIMER_LIST
Definition threads.h:786
uint32_t STDCALL mutex_flags(MUTEX_HANDLE mutex)
Get the current flags of an existing Mutex entry.
uint32_t STDCALL thread_snapshot_destroy(THREAD_SNAPSHOT *snapshot)
uint32_t STDCALL synchronizer_reader_lock(SYNCHRONIZER_HANDLE synchronizer)
Lock an existing Synchronizer entry for reading.
THREAD_HANDLE STDCALL critical_section_owner(CRITICAL_SECTION_HANDLE criticalsection)
Get the current owner of an existing CriticalSection entry.
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 buffer_destroy(BUFFER_HANDLE buffer)
Destroy and remove an existing Buffer entry.
SPIN_HANDLE STDCALL spin_create(void)
Create and insert a new Spin entry.
uint32_t STDCALL critical_section_lock_ex(CRITICAL_SECTION_HANDLE criticalsection, uint32_t timeout)
Lock an existing CriticalSection entry.
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 thread_tls_get_count(void)
Get the current thread tls count.
uint32_t STDCALL thread_get_stack_size(THREAD_HANDLE thread)
Get the current stack size of a thread.
#define SCHEDULER_QUANTUM_LOWER
Definition threads.h:372
uint32_t STDCALL tasker_semaphore_signal(SEMAPHORE_HANDLE semaphore, uint32_t count)
Perform a SemaphoreSignal() function call using the tasker list.
int STDCALL timer_first_key(void)
Get the first Key value from the Timer list.
BOOL STDCALL spin_check_irq(SPIN_HANDLE spin)
Check the mask that stores the previous IRQ state to determine if IRQ is enabled.
QUEUE_HANDLE STDCALL queue_create_ex(uint32_t queuetype, uint32_t flags)
Create and insert a new Queue entry.
uint32_t STDCALL thread_remove_flags(THREAD_HANDLE thread, uint32_t flags)
Remove flags from the current flags of a thread.
uint32_t STDCALL thread_ready(THREAD_HANDLE thread, BOOL reschedule)
Place the supplied Thread on the ready queue.
struct _TASKER_SEMAPHORE_SIGNAL TASKER_SEMAPHORE_SIGNAL
Definition threads.h:890
uint32_t STDCALL scheduler_get_thread_quantum(uint32_t cpuid)
Get the current thread quantum for the specified CPU.
uint32_t STDCALL timer_disable(TIMER_HANDLE timer)
Disable an existing Timer entry (Timer events will not be generated).
BOOL STDCALL timer_is_empty(void)
Check if the Timer list is empty.
void STDCALL end_thread(uint32_t exitcode)
End the current thread.
uint32_t STDCALL tasker_get_count(void)
Get the current tasker count.
uint32_t STDCALL critical_section_unlock(CRITICAL_SECTION_HANDLE criticalsection)
Unlock an existing CriticalSection entry.
LIST_ELEMENT *STDCALL list_get_first_ex(LIST_HANDLE list, BOOL remove)
Get the first element from the List.
uint32_t STDCALL scheduler_allocation_to_string(uint32_t allocation, char *string, uint32_t len)
uint32_t STDCALL semaphore_wait(SEMAPHORE_HANDLE semaphore)
Wait on an existing Semaphore entry.
THREAD_HANDLE STDCALL synchronizer_writer_owner(SYNCHRONIZER_HANDLE synchronizer)
Get the current writer owner of an existing Synchronizer entry.
void STDCALL(* thread_end_proc)(uint32_t exitcode)
Definition threads.h:926
uint32_t STDCALL critical_section_try_lock(CRITICAL_SECTION_HANDLE criticalsection)
Try to lock 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.
BOOL STDCALL list_not_empty(LIST_HANDLE list)
Check if the supplied List is empty.
uint32_t STDCALL worker_get_count(void)
Get the current worker thread count.
MESSAGESLOT_HANDLE STDCALL messageslot_create_ex(uint32_t maximum, uint32_t flags)
Create and insert a new Messageslot entry.
#define SCHEDULER_MASK_HIGHER
Definition threads.h:354
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 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 spin_exchange_fiq(SPIN_HANDLE spin1, SPIN_HANDLE spin2)
Exchange the previous FIQ state between two Spin entries.
LIST_ELEMENT *STDCALL list_get_last(LIST_HANDLE list)
Get the last element from the List.
uint32_t STDCALL thread_terminate(THREAD_HANDLE thread, uint32_t exitcode)
Terminate but do not destroy the supplied Thread.
void STDCALL thread_end(uint32_t exitcode)
Terminate the current Thread.
SEMAPHORE_HANDLE STDCALL semaphore_create_ex(uint32_t count, uint32_t maximum, uint32_t flags)
Create and insert a new Semaphore entry.
struct _EVENT_ENTRY EVENT_ENTRY
Definition threads.h:765
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.
struct _SEMAPHORE_ENTRY SEMAPHORE_ENTRY
Definition threads.h:452
TASKER_TASK *STDCALL tasker_dequeue(void)
Get and remove the first task from the Tasker list.
uint32_t STDCALL mailslot_send(MAILSLOT_HANDLE mailslot, ssize_t data)
Send a message to a Mailslot.
void *STDCALL buffer_get(BUFFER_HANDLE buffer)
Allocate an available buffer from an existing Buffer entry.
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 scheduler_set_priority_quantum(uint32_t priority, uint32_t quantum)
Set the scheduler quantum for the specified thread priority.
ssize_t STDCALL(* thread_start_proc)(void *parameter)
Definition threads.h:925
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.
uint32_t STDCALL thread_halt(uint32_t exitcode)
Halt the current thread so it will never be rescheduled.
uint32_t STDCALL queue_get_count(void)
Get the current queue count.
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.
#define SCHEDULER_QUANTUM_LOWEST
Definition threads.h:371
uint32_t STDCALL thread_unlock(THREAD_HANDLE thread)
Unlok a thread that was locked by ThreadLock.
uint32_t STDCALL synchronizer_writer_lock(SYNCHRONIZER_HANDLE synchronizer)
Lock an existing Synchronizer entry for writing.
SEMAPHORE_HANDLE STDCALL semaphore_create(uint32_t count)
Create and insert a new Semaphore entry.
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 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.
THREAD_HANDLE STDCALL spin_owner(SPIN_HANDLE spin)
Get the current owner of an existing Spin entry.
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.
int STDCALL queue_first_key(QUEUE_HANDLE queue)
Get the first Key value from the Queue.
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 queu...
uint32_t STDCALL messageslot_receive_ex(MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message, uint32_t timeout)
Receive a message from a Messageslot.
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 synchronizer_writer_lock_ex(SYNCHRONIZER_HANDLE synchronizer, uint32_t timeout)
Lock an existing Synchronizer entry for writing.
uint32_t STDCALL scheduler_get_list_flags(uint32_t listtype)
Get the list flags for the specified type of list.
struct _LIST_ELEMENT LIST_ELEMENT
Definition threads.h:541
uint32_t STDCALL scheduler_preempt_disable(uint32_t cpuid)
Disable thread preemption for the specified CPU.
struct _CONDITION_ENTRY CONDITION_ENTRY
Definition threads.h:499
uint32_t STDCALL worker_get_priority_count(void)
Get the current worker priority thread count.
uint32_t STDCALL thread_get_state(THREAD_HANDLE thread)
Get the current state of a thread (eg THREAD_STATE_SUSPENDED).
uint32_t STDCALL thread_receive_message(THREAD_MESSAGE *message)
Make the current thread wait to receive a message (indefinitely).
uint32_t STDCALL messageslot_receive(MESSAGESLOT_HANDLE messageslot, THREAD_MESSAGE *message)
Receive a message from a Messageslot.
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.
#define THREAD_NAME_LENGTH
Length of thread name.
Definition threads.h:223
size_t STDCALL thread_get_stack_pointer(THREAD_HANDLE thread)
Get the current stack pointer of a thread.
ssize_t STDCALL mailslot_receive_ex(MAILSLOT_HANDLE mailslot, uint32_t timeout)
Receive a message from a Mailslot.
uint32_t STDCALL thread_priority_to_string(uint32_t threadpriority, char *string, uint32_t len)
uint32_t STDCALL thread_set_last_error_ex(uint32_t lasterror)
Set the last error value for the current Thread.
struct _LIST_ENTRY LIST_ENTRY
Definition threads.h:542
QUEUE_HANDLE STDCALL queue_create(void)
Create and insert a new Queue entry.
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 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(LIST_HANDLE list)
Release the first thread waiting on the supplied list and return with WAIT_ABANDONED.