summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadqenqueue.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* score: Introduce Thread_queue_Lock_contextSebastian Huber2016-09-081-25/+27
| | | | | | Introduce Thread_queue_Lock_context to contain the context necessary for thread queue lock and thread wait lock acquire/release operations to reduce the Thread_Control size.
* score: Simplify thread queue acquire/releaseSebastian Huber2016-09-081-2/+2
|
* score: Introduce thread queue surrender operationSebastian Huber2016-08-111-3/+1
| | | | | | This is an optimization for _Thread_queue_Surrender(). It helps to encapsulate the priority boosting in the priority inheritance thread queue operations.
* score: Dismantle _Thread_queue_Do_extract_locked()Sebastian Huber2016-08-111-28/+39
| | | | | | | Dismantle _Thread_queue_Do_extract_locked() into re-usable parts like _Thread_queue_MP_set_callout() and _Thread_queue_Make_ready_again(). Use them in _Thread_queue_Surrender() to propare for a new thread queue surrender operation.
* score: Add _Thread_queue_Surrender()Sebastian Huber2016-08-111-0/+50
| | | | | Add _Thread_queue_Surrender() to unify the mutex surrender procedures which involve a thread queue operation.
* score: Add debug support to red-black treesSebastian Huber2016-08-081-0/+1
| | | | This helps to detect double insert and extract errors.
* score: Fix _Thread_queue_Path_release()Sebastian Huber2016-08-041-8/+13
| | | | | | It is possible that the owner of the terminal link of a thread queue path waits on a thread queue. However, this thread queue has no owner, e.g. a thread queue of a message queue.
* score: Optimize _Thread_queue_Path_release()Sebastian Huber2016-08-041-7/+29
| | | | Update #2556.
* score: Fix and simplify thread wait locksSebastian Huber2016-08-031-20/+24
| | | | | | | | | | There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
* score: Add deadlock detectionSebastian Huber2016-07-271-15/+250
| | | | | | | | | | The mutex objects use the owner field of the thread queues for the mutex owner. Use this and add a deadlock detection to _Thread_queue_Enqueue_critical() for thread queues with an owner. Update #2412. Update #2556. Close #2765.
* score: Turn thread lock into thread wait lockSebastian Huber2016-07-271-23/+68
| | | | | | | | | The _Thread_Lock_acquire() function had a potentially infinite run-time due to the lack of fairness at atomic operations level. Update #2412. Update #2556. Update #2765.
* score: Priority inherit thread queue operationsSebastian Huber2016-07-271-3/+5
| | | | | | | | | Move the priority change due to priority interitance to the thread queue enqueue operation to simplify the locking on SMP configurations. Update #2412. Update #2556. Update #2765.
* score: FormatSebastian Huber2016-07-261-9/+9
|
* cpukit: Add and use Watchdog_Discipline.Gedare Bloom2016-07-251-8/+22
| | | | | | | | | Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE, or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline of WATCHDOG_NO_TIMEOUT. updates #2732
* score: Avoid atomic fences for thread wait flagsSebastian Huber2016-06-301-2/+2
| | | | | The use of atomic fences is brittle and may break due to changes in different areas which is hard to manage.
* score: Fix thread lock on SMP configurationsSebastian Huber2016-06-301-1/+1
|
* score: Comment _Thread_queue_Enqueue_critical()Sebastian Huber2016-06-091-0/+9
|
* score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber2016-05-301-3/+14
| | | | | | | | | | | Move the safety check performed by _CORE_mutex_Check_dispatch_for_seize() out of the performance critical path and generalize it. Blocking on a thread queue with an unexpected thread dispatch disabled level is illegal in all system states. Add the expected thread dispatch disable level (which may be 1 or 2 depending on the operation) to Thread_queue_Context and use it in _Thread_queue_Enqueue_critical().
* score: Add _Thread_queue_Context_set_MP_callout()Sebastian Huber2016-05-301-5/+7
| | | | | | Add _Thread_queue_Context_set_MP_callout() to simplify _Thread_queue_Context_initialize(). This makes it possible to more easily add additional fields to Thread_queue_Context.
* score: Add Status_Control for all APIsSebastian Huber2016-05-261-2/+2
| | | | | | | | | | | 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.
* score: Move thread queue MP callout to contextSebastian Huber2016-05-251-25/+26
| | | | | | | | 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.
* score: Get rid of mp_id parameterSebastian Huber2016-05-251-15/+9
| | | | | Get rid of the mp_id parameter used for some thread queue methods. Use THREAD_QUEUE_QUEUE_TO_OBJECT() instead.
* mpci: Fix thread queue flush methodSebastian Huber2016-05-251-42/+25
| | | | | | | 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().
* score: Rework MP thread queue callout supportSebastian Huber2016-04-061-24/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* score: Fix _Thread_queue_Extract_locked()Sebastian Huber2016-04-061-4/+8
| | | | | | We must update the wait flags under protection of the current thread lock, otherwise a _Thread_Timeout() running on another processor may interfere.
* score: Fix multiprocessing thread proxiesSebastian Huber2016-03-291-5/+6
| | | | | | | We must provide thread queue heads for the thread wait information for each thread proxy (thread queue heads were introduced by d7665823b208daefb6855591d808e1f3075cedcb). The thread proxy must be allocated before the enqueue operation.
* score: Remove Thread_queue_Queue::operations fieldSebastian Huber2016-03-291-3/+6
| | | | | | | | | 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.
* score: Replace watchdog handler implementationSebastian Huber2016-03-041-3/+7
| | | | | | | | | Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
* score: Use a plain ticket lock for thread locksSebastian Huber2015-07-301-1/+1
| | | | | | This enables external libraries to use thread locks since they are independent of the actual RTEMS build configuration, e.g. profiling enabled or disabled.
* score: Move wait flag update to tq extractSebastian Huber2015-07-231-13/+18
| | | | | | This makes it possible to use _Thread_queue_Extract_locked() for barrier operations which extract all threads on the queue in one critical section.
* score: Introduce Thread_queue_QueueSebastian Huber2015-07-231-37/+48
| | | | | | Separate the thread queue heads and lock from the operations. This enables the support for light weight objects which only support one queuing discipline.
* score: _Thread_Dispatch_disable_critical()Sebastian Huber2015-05-191-2/+2
| | | | | | | Thread dispatching is disabled in case interrupts are disabled. To get an accurate thread dispatch disabled time it is important to use the interrupt disabled instant in case a transition from an interrupt disabled section to a thread dispatch level section happens.
* score: Delete Thread_queue_Control::timeout_statusSebastian Huber2015-05-191-4/+2
| | | | | Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
* score: New thread queue implementationSebastian Huber2015-05-191-128/+104
| | | | | | | | | 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.
* score: More thread queue operationsSebastian Huber2015-05-191-49/+9
| | | | | | | | | Move thread queue discipline specific operations into Thread_queue_Operations. Use a separate node in the thread control block for the thread queue to make it independent of the scheduler data structures. Update #2273.
* score: Add Thread_queue_OperationsSebastian Huber2015-05-191-24/+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.
* score: Add Thread_queue_Control::LockSebastian Huber2015-05-191-33/+30
| | | | | | | | | | | 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.
* score: Add header to _Watchdog_Remove()Sebastian Huber2015-05-191-1/+1
| | | | | | | | Add watchdog header parameter to _Watchdog_Remove() to be in line with the other operations. Add _Watchdog_Remove_ticks() and _Watchdog_Remove_seconds() for convenience. Update #2307.
* score: Delete STATES_WAITING_ON_THREAD_QUEUESebastian Huber2015-05-191-3/+2
| | | | | | Avoid the usage of the current thread state in _Thread_queue_Extract_with_return_code() since thread queues should not know anything about thread states.
* score: _Thread_queue_Extract()Sebastian Huber2015-05-191-8/+6
| | | | | Remove thread queue parameter from _Thread_queue_Extract() since the current thread queue is stored in the thread control block.
* score: Delete Thread_queue_Control::stateSebastian Huber2015-04-231-2/+3
| | | | | Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
* score: Delete _CORE_RWLock_Timeout()Sebastian Huber2015-04-221-6/+5
| | | | | This function was identical to _Thread_queue_Timeout(). This makes _Thread_queue_Enqueue_with_handler() obsolete.
* score: Fix thread queue race conditionSebastian Huber2015-04-091-1/+0
| | | | | | | On uni-processor configurations the change of the thread blocking state in _Thread_queue_Requeue_priority() did no harm and was simply useless. However on SMP configurations this resulted in invalid state changes leading to a wrong resource ownership.
* score: Use a dedicated ISR lock for thread queuesSebastian Huber2015-03-241-20/+34
| | | | | | | | This makes it possible to use the standard thread queues in combination with objects using fine grained locking. There is no change for uni-processor configurations. Update #2273.
* score: Add thread priority change handlerSebastian Huber2015-03-241-42/+25
| | | | | | | | | | 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.
* score: Simplify debug code and use _Assert()Sebastian Huber2015-03-221-57/+10
|
* score: Move _Thread_queue_Requeue()Sebastian Huber2015-03-221-0/+42
| | | | Now all the main thread queue operations are in one module.
* score: Move _Thread_queue_Extract()Sebastian Huber2015-03-221-2/+116
| | | | | | | | Move _Thread_queue_Dequeue(). We need all or no thread queue functions so it makes no sense to have them in separate modules. One module enables compiler optimizations without link-time optimization. Make _Thread_blocking_operation_Finalize() static since it is use now only in one module.
* score: Move _Thread_blocking_operation_Cancel()Sebastian Huber2015-03-221-0/+89
| | | | | | | Move _Thread_blocking_operation_Cancel() and make static since it is only used by _Thread_queue_Enqueue_with_handler(). Move _Thread_blocking_operation_Finalize().
* Thread Queue: Merge discipline subroutines into main methodsJoel Sherrill2014-07-151-12/+31
| | | | | | | | | | | 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.