summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/threadqimpl.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-05-30score: Adjust thread queue layoutSebastian Huber1-3/+4
Adjust thread queue layout according to Newlib. This makes it possible to use the same implementation for <sys/lock.h> and CORE mutexes in the future.
2016-05-26score: Add Status_Control for all APIsSebastian Huber1-5/+35
Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
2016-05-25score: Move thread queue MP callout to contextSebastian Huber1-109/+82
Drop the multiprocessing (MP) dependent callout parameter from the thread queue extract, dequeue, flush and unblock methods. Merge this parameter with the lock context into new structure Thread_queue_Context. This helps to gets rid of the conditionally compiled method call helpers.
2016-05-25score: Get rid of mp_id parameterSebastian Huber1-30/+8
Get rid of the mp_id parameter used for some thread queue methods. Use THREAD_QUEUE_QUEUE_TO_OBJECT() instead.
2016-05-25score: Move thread queue object supportSebastian Huber1-0/+27
2016-05-25mpci: Fix thread queue flush methodSebastian Huber1-49/+11
We must call the MP callout for proxies if we unblock them after a thread queue extraction. This was missing in _Thread_queue_Flush_critical(). Move thread remove timer and unblock code to new function _Thread_Remove_timer_and_unblock().
2016-05-20score: Use _RBTree_Insert_inline()Sebastian Huber1-15/+0
Use _RBTree_Insert_inline() for priority thread queues. Update #2556.
2016-05-12score: Avoid Giant lock for scheduler set/getSebastian Huber1-3/+23
Update #2555.
2016-05-12score: Add _Thread_queue_Is_lock_owner()Sebastian Huber1-3/+45
Add _Thread_queue_Is_lock_owner() in case RTEMS_DEBUG is defined.
2016-04-22score: Add _Thread_queue_Flush_default_filter()Sebastian Huber1-0/+15
2016-04-22score: Add _Thread_queue_Is_empty()Sebastian Huber1-0/+7
2016-04-21score: Introduce _Thread_queue_Flush_critical()Sebastian Huber1-24/+63
Replace _Thread_queue_Flush() with _Thread_queue_Flush_critical() and add a filter function for customization of the thread queue flush operation. Update #2555.
2016-04-06score: Rework MP thread queue callout supportSebastian Huber1-31/+182
The thread queue implementation was heavily reworked to support SMP. This broke the multiprocessing support of the thread queues. This is fixed by this patch. A thread proxy is unblocked due to three reasons 1) timeout, 2) request satisfaction, and 3) extraction. In case 1) no MPCI message must be sent. This is ensured via the _Thread_queue_MP_callout_do_nothing() callout set during _Thread_MP_Allocate_proxy(). In case 2) and 3) an MPCI message must be sent. In case we interrupt the blocking operation during _Thread_queue_Enqueue_critical(), then this message must be sent by the blocking thread. For this the new fields Thread_Proxy_control::thread_queue_callout and Thread_Proxy_control::thread_queue_id are used. Delete the individual API MP callout types and use Thread_queue_MP_callout throughout. This type is only defined in multiprocessing configurations. Prefix the multiprocessing parameters with mp_ to ease code review. Multiprocessing specific parameters are optional due to use of a similar macro pattern. There is no overhead for non-multiprocessing configurations.
2016-04-06score: _Thread_queue_Flush() parameter changesSebastian Huber1-20/+61
Change _Thread_queue_Flush() into a macro that invokes _Thread_queue_Do_flush() with the parameter set defined by RTEMS_MULTIPROCESSING. For multiprocessing configurations add the object identifier to avoid direct use of the thread wait information. Use mp_ prefix for multiprocessing related parameters. Rename Thread_queue_Flush_callout to Thread_queue_MP_callout since this type will be re-used later for other operations as well.
2016-03-29score: Remove Thread_queue_Queue::operations fieldSebastian Huber1-60/+32
Remove the Thread_queue_Queue::operations field to reduce the size of this structure. Add a thread queue operations parameter to the _Thread_queue_First(), _Thread_queue_First_locked(), _Thread_queue_Enqueue(), _Thread_queue_Dequeue() and _Thread_queue_Flush() functions. This is a preparation patch to reduce the size of several synchronization objects.
2015-09-04score: Implement priority boostingSebastian Huber1-0/+25
2015-09-04score: Implement SMP-specific priority queueSebastian Huber1-0/+16
2015-07-30score: Add thread queue for self-contained objectsSebastian Huber1-0/+18
2015-07-30score: Use a plain ticket lock for thread locksSebastian Huber1-9/+64
This enables external libraries to use thread locks since they are independent of the actual RTEMS build configuration, e.g. profiling enabled or disabled.
2015-07-23score: Move wait flag update to tq extractSebastian Huber1-1/+12
This makes it possible to use _Thread_queue_Extract_locked() for barrier operations which extract all threads on the queue in one critical section.
2015-07-23score: Introduce Thread_queue_HeadsSebastian Huber1-21/+19
Move the storage for the thread queue heads to the threads. Each thread provides a set of thread queue heads allocated from a dedicated memory pool. In case a thread blocks on a queue, then it lends its heads to the queue. In case the thread unblocks, then it takes a free set of threads from the queue. Since a thread can block on at most one queue this works. This mechanism is used in FreeBSD. The motivation for this change is to reduce the memory demands of the synchronization objects. On a 32-bit uni-processor configuration the Thread_queue_Control size is now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced the size as well).
2015-07-23score: Introduce Thread_queue_QueueSebastian Huber1-37/+77
Separate the thread queue heads and lock from the operations. This enables the support for light weight objects which only support one queuing discipline.
2015-07-13score: TypoSebastian Huber1-2/+2
2015-05-19score: Add static initializers for thread queuesSebastian Huber1-0/+34
2015-05-19score: Delete Thread_queue_Control::timeout_statusSebastian Huber1-5/+7
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
2015-05-19score: New thread queue implementationSebastian Huber1-54/+135
Use thread wait flags for synchronization. The enqueue operation is now part of the initial critical section. This is the key change and enables fine grained locking on SMP for objects using a thread queue like semaphores and message queues. Update #2273.
2015-05-19score: Add Thread_queue_OperationsSebastian Huber1-0/+6
Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
2015-05-19score: Add Thread_queue_Control::LockSebastian Huber1-28/+86
Move the complete thread queue enqueue procedure into _Thread_queue_Enqueue_critical(). It is possible to use the thread queue lock to protect state of the object embedding the thread queue. This enables per object fine grained locking in the future. Delete _Thread_queue_Enter_critical_section(). Update #2273.
2015-05-19score: _Thread_queue_Extract()Sebastian Huber1-11/+5
Remove thread queue parameter from _Thread_queue_Extract() since the current thread queue is stored in the thread control block.
2015-04-30score: Delete unused Thread_queue_Timeout_calloutSebastian Huber1-9/+0
2015-04-23score: Delete _Thread_queue_Dequeue_priority()Sebastian Huber1-19/+0
2015-04-23score: Delete Thread_queue_Control::stateSebastian Huber1-2/+2
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
2015-04-22score: Delete _CORE_RWLock_Timeout()Sebastian Huber1-18/+4
This function was identical to _Thread_queue_Timeout(). This makes _Thread_queue_Enqueue_with_handler() obsolete.
2015-04-22score: Delete bogus THREAD_QUEUE_WAIT_FOREVERSebastian Huber1-5/+0
It makes no sense to use this indirection since the type for timeout values is Watchdog_Interval.
2015-03-24score: Add thread priority change handlerSebastian Huber1-17/+0
Since the thread current priority change and thread queue requeue is performed in one critical section it is possible to simplify the thread queue requeue procedure. Add a thread queue agnostic thread priority change handler so that we are able to use alternative thread queue implementations. Update #2273.
2015-03-06Fix more Doxygen typosJoel Sherrill1-3/+3
2014-08-05rbtree: Add and use RBTree_Compare_resultSebastian Huber1-1/+1
2014-07-15Thread Queue: Merge discipline subroutines into main methodsJoel Sherrill1-133/+24
There was a lot of duplication between the discipline subroutines. With the transition to RBTrees for priority discipline, there were only a few lines of source code manipulating the data structure for FIFO and priority. Thus is made sense to fold these back into the main methods. As part of doing this all of the tests for discipline were changed to be in the same order.
2014-07-15Thread Queue Priority Discipline Reimplemented with RBTreeJoel Sherrill1-41/+30
2014-05-15score: Make _Thread_queue_Requeue() staticSebastian Huber1-17/+0
This function is only used by _Thread_Change_priority(). Make it static to avoid the function call overhead in the performance critical function _Thread_Change_priority().
2014-04-01score: PR2172: _Thread_queue_Extract()Sebastian Huber1-9/+14
Add _Thread_queue_Extract_with_return_code(). On SMP this sequence in _Thread_queue_Process_timeout() was broken: [...] /* * After we enable interrupts here, a lot may happen in the * meantime, e.g. nested interrupts may release the resource that * times out here. So we enter _Thread_queue_Extract() * speculatively. Inside this function we check the actual status * under ISR disable protection. This ensures that exactly one * executing context performs the extract operation (other parties * may call _Thread_queue_Dequeue()). If this context won, then * we have a timeout. * * We can use the_thread_queue pointer here even if * the_thread->Wait.queue is already set to NULL since the extract * operation will only use the thread queue discipline to select * the right extract operation. The timeout status is set during * thread queue initialization. */ we_did_it = _Thread_queue_Extract( the_thread_queue, the_thread ); if ( we_did_it ) { the_thread->Wait.return_code = the_thread_queue->timeout_status; } [...] In case _Thread_queue_Extract() successfully extracted a thread, then this thread may start execution on a remote processor immediately and read the the_thread->Wait.return_code before we update it here with the timeout status. Thus it observes a successful operation even if it timed out.
2014-03-31score: _Thread_queue_Extract_with_proxy()Sebastian Huber1-1/+1
Drop the return status, since it is nowhere used.
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2013-08-26score: Delete unused function parameterSebastian Huber1-4/+2
2013-08-26score: PR2140: _Thread_queue_Extract()Sebastian Huber1-3/+9
Return if the executing context performed the extract operation since interrupts may interfere.
2013-08-23score: _Thread_queue_Enqueue_with_handler()Sebastian Huber1-4/+7
Add thread parameter to _Thread_queue_Enqueue_with_handler() to avoid access to global _Thread_Executing.
2013-07-26score: Create threadq implementation headerSebastian Huber1-12/+53
Move implementation specific parts of tqdata.h, threadq.h and threadq.inl into new header file threadqimpl.h. The threadq.h contains now only the application visible API. Delete tqdata.h.
2013-07-26score: Delete threadq.inlSebastian Huber1-15/+11
2013-01-10cpukit: Fix many Doxygen warningsJoel Sherrill1-2/+12
2013-01-10cpukit: Add EOL on files missing EOL at EOFJoel Sherrill1-1/+1