summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadimpl.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* score: Maybe fix _Thread_Lock_acquire()Sebastian Huber2016-06-021-37/+7
| | | | | | | The approach with the generation number was broken. The load/store of the current lock, the thread queue and the thread queue operations were not properly synchronized. Under certain conditions on a PowerPC T4240 old thread queue operations operated on a new thread queue (NULL pointer).
* score: Fix _Thread_Lock_acquire()Sebastian Huber2016-06-011-11/+12
| | | | | | | | | A read-modify-write operation is necessary to read the last value written. See for example C11 standard or Power ISA 2.07, Book II: Power ISA Virtual Environment Architecture, Section 1.6.3 Memory Coherence Required [Category: Memory Coherence] and Section 1.7.3 Atomic Update.
* score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber2016-05-301-4/+4
| | | | | | | | | | | 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 Status_Control for all APIsSebastian Huber2016-05-261-14/+8
| | | | | | | | | | | 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 object supportSebastian Huber2016-05-251-20/+0
|
* mpci: Fix thread queue flush methodSebastian Huber2016-05-251-0/+19
| | | | | | | 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().
* Replace *_Get_interrupt_disable() with *_Get()Sebastian Huber2016-05-201-1/+1
| | | | | Uniformly use *_Get() to get an object by identifier with a lock context.
* score: Rename _Objects_Get_local()Sebastian Huber2016-05-201-1/+1
| | | | | | Rename _Objects_Get_local() into _Objects_Get(). Confusions with the previous _Objects_Get() function are avoided since the Objects_Locations parameter is gone.
* score: Rename _ISR_Disable() and _ISR_Enable()Sebastian Huber2016-05-201-1/+1
| | | | | | | | | Rename _ISR_Disable() into _ISR_Local_disable(). Rename _ISR_Enable() into _ISR_Local_enable(). Remove _Debug_Is_owner_of_giant(). This is a preparation to remove the Giant lock. Update #2555.
* score: Rename _ISR_Disable_without_giant()Sebastian Huber2016-05-201-2/+2
| | | | | | | | | Rename _ISR_Disable_without_giant() into _ISR_Local_disable(). Rename _ISR_Enable_without_giant() into _ISR_Local_enable(). This is a preparation to remove the Giant lock. Update #2555.
* score: Delete unused _Thread_Get()Sebastian Huber2016-05-201-26/+0
| | | | Update #2555.
* posix: Rework thread cancellationSebastian Huber2016-05-201-1/+8
| | | | | | | | Add Thread_Life_state::THREAD_LIFE_CHANGE_DEFERRED and rework the POSIX thread cancellation to use the thread life states. Update #2555. Update #2626.
* score: Avoid Giant lock for _Thread_Start()Sebastian Huber2016-05-201-16/+2
| | | | Update #2555.
* posix: Rework pthread_join()Sebastian Huber2016-05-201-2/+18
| | | | | | | | | Rework pthread_join() to use _Thread_Join(). Close #2402. Update #2555. Update #2626. Close #2714.
* score: Split _Thread_Restart()Sebastian Huber2016-05-201-27/+9
| | | | | | | | | | | Split _Thread_Restart() into _Thread_Restart_self() and _Thread_Restart_other(). Move content of existing _Thread_Restart_self() into new _Thread_Restart_self(). Avoid Giant lock for thread restart. _Thread_Restart_self() is a no-return function and used by _Thread_Global_construction(). Update #2555. Update #2626.
* score: Add _Thread_Clear_state_locked()Sebastian Huber2016-05-201-0/+5
| | | | | | | | This makes it possible to do thread state and thread life changes together under protection of the thread state lock. Update #2555. Update #2626.
* score: Add _Thread_Set_state_locked()Sebastian Huber2016-05-201-0/+5
| | | | | | | | This makes it possible to do thread state and thread life changes together under protection of the thread state lock. Update #2555. Update #2626.
* score: Add _Thread_Join() and _Thread_Cancel()Sebastian Huber2016-05-201-0/+9
| | | | | | | | Split _Thread_Close() into _Thread_Join() and _Thread_Cancel() to prepare for a re-use in pthread_join() and pthread_cancel(). Update #2555. Update #2626.
* score: Add Thread_Change_life()Sebastian Huber2016-05-201-3/+3
| | | | | | | | | Add _Thread_Change_life_locked() as a general function to alter the thread life state. Use it to implement _Thread_Set_life_protection() as a first step. Update #2555. Update #2626.
* score: Add _Thread_Exit()Sebastian Huber2016-05-201-0/+2
| | | | | | | | The goal is to make _Thread_Exit() a no-return function in follow up patches. Update #2555. Update #2626.
* score: Delete redundant thread life enumsSebastian Huber2016-05-201-1/+2
| | | | | | | This makes it easier to add more states in the future. Update #2555. Update #2626.
* score: Avoid Giant lock for scheduler set/getSebastian Huber2016-05-121-0/+8
| | | | Update #2555.
* score: Introduce thread state lockSebastian Huber2016-05-121-47/+51
| | | | Update #2556.
* score: Simplify _Thread_Get_interrupt_disable()Sebastian Huber2016-05-041-2/+1
| | | | Remove the object location parameter.
* score: Add _Thread_MP_Is_remote()Sebastian Huber2016-05-041-0/+21
|
* score: Simplify _Objects_Initialize_information()Sebastian Huber2016-04-211-4/+0
| | | | | | Remove unused supports_global parameter. Convert _Objects_Initialize_information() to a macro to avoid use of RTEMS_MULTIPROCESSING define for each caller.
* score: Delete Thread_Wait_information::idSebastian Huber2016-04-061-0/+36
| | | | | | | | | | | This field was only by the monitor in non-multiprocessing configurations. Add new field Thread_Wait_information::remote_id in multiprocessing configurations and use it for the remote procedure call thread queue. Add _Thread_Wait_get_id() to obtain the object identifier for debug and system information tools. Ensure the object layout via static asserts. Add test cases to sptests/spthreadq01.
* score: Fix multiprocessing thread proxiesSebastian Huber2016-03-291-0/+10
| | | | | | | 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.
* rtems: Rework rate-monotonic schedulerSebastian Huber2016-03-221-1/+6
| | | | | | | | | | Use the default thread lock to protect rate-monotonic state changes. This avoids use of the Giant lock. Split rtems_rate_monotonic_period() body into several static functions. Introduce a new thread wait class THREAD_WAIT_CLASS_PERIOD for period objects to synchronize the blocking operation. Close #2631.
* score: C++ compatibilitySebastian Huber2016-03-181-1/+1
|
* score: Fix CPU time used by executing threadsSebastian Huber2016-03-171-47/+20
| | | | | | | | | | | | | | The CPU time used of a thread was previously maintained per-processor mostly during _Thread_Dispatch(). However, on SMP configurations the actual processor of a thread is difficult to figure out since thread dispatching is a highly asynchronous process (e.g. via inter-processor interrupts). Only the intended processor of a thread is known to the scheduler easily. Do the CPU usage accounting during thread heir updates in the context of the scheduler operations. Provide the function _Thread_Get_CPU_time_used() to get the CPU usage of a thread using proper locks to get a consistent value. Close #2627.
* score: Replace watchdog handler implementationSebastian Huber2016-03-041-3/+58
| | | | | | | | | Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
* score: Avoid SCORE_EXTERNSebastian Huber2016-02-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Delete SCORE_INIT. This finally removes the some.h: #ifndef SOME_XYZ_EXTERN #define SOME_XYZ_EXTERN extern #endif SOME_XYZ_EXTERN type xyz; some_xyz.c: #define SOME_XYZ_EXTERN #include <some.h> pattern in favour of some.h: extern type xyz; some_xyz.c #include <some.h> type xyz; Update #2559.
* score: Simplify _Thread_Start()Sebastian Huber2016-01-111-5/+1
|
* score: Introduce Thread_Entry_informationSebastian Huber2016-01-111-16/+18
| | | | | | | This avoids potential dead code in _Thread_Handler(). It gets rid of the dangerous function pointer casts. Update #2514.
* score: Avoid dead code in global constructionSebastian Huber2016-01-081-1/+1
| | | | Update #2514.
* score: Untangle thread actionsSebastian Huber2015-12-111-5/+6
| | | | | | | Remove the thread action handler parameter from _Thread_Action_initialize() and instead set it later in _Thread_Add_post_switch_action(). This avoids a dependency on the thread action handler via the thread initialization.
* Require __getreent()Sebastian Huber2015-11-251-32/+0
| | | | | This function is used by Newlib since 2013-07-09 (Git commit 9b51cd8c6b9cdd067d9648a7ab952884019c56a5).
* basedefs.h: Add and use RTEMS_NO_RETURNSebastian Huber2015-10-261-1/+1
|
* SMP: Fix and optimize thread dispatchingSebastian Huber2015-09-281-32/+13
| | | | | | | | According to the C11 and C++11 memory models only a read-modify-write operation guarantees that we read the last value written in modification order. Avoid the sequential consistent thread fence and instead use the inter-processor interrupt to set the thread dispatch necessary indicator.
* SMP: Simplify thread lock operationsSebastian Huber2015-09-281-27/+25
|
* score: Implement priority boostingSebastian Huber2015-09-041-0/+31
|
* score: Use a plain ticket lock for thread locksSebastian Huber2015-07-301-29/+51
| | | | | | 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: Add commentSebastian Huber2015-07-241-0/+5
|
* score: Introduce Thread_queue_HeadsSebastian Huber2015-07-231-3/+23
| | | | | | | | | | | | | 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).
* score: Introduce Thread_queue_QueueSebastian Huber2015-07-231-2/+2
| | | | | | 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: Simplify _Thread_Lock_set()Sebastian Huber2015-07-131-11/+56
| | | | | Exploit the fact that the current thread lock must be the default thread lock and interrupts are disabled if we call _Thread_Lock_set().
* score: Rework _Thread_Change_priority()Sebastian Huber2015-05-191-14/+100
| | | | | | | | | | | | | Move the writes to Thread_Control::current_priority and Thread_Control::real_priority into _Thread_Change_priority() under the protection of the thread lock. Add a filter function to _Thread_Change_priority() to enable specialized variants. Avoid race conditions during a thread priority restore with the new Thread_Control::priority_restore_hint for an important average case optimizations used by priority inheritance mutexes. Update #2273.
* score: More thread queue operationsSebastian Huber2015-05-191-1/+4
| | | | | | | | | 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-35/+53
| | | | | | | | 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.