summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/threadimpl.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Do not use RTEMS_INLINE_ROUTINESebastian Huber2022-09-191-83/+83
| | | | | | | Directly use "static inline" which is available in C99 and later. This brings the RTEMS implementation closer to standard C. Close #3935.
* score: Use PTHREAD_CANCELED for _Thread_Cancel()Sebastian Huber2022-07-281-4/+1
| | | | | | | | | | The rtems_task_delete() directive is basically just a combined pthread_cancel() and pthread_join(). In addition, it removes the PTHREAD_DETACHED state. The exit value returned by pthread_join() of threads cancelled by rtems_task_delete() should reflect this by getting a PTHREAD_CANCELED value instead of NULL which could be a normal exit value. Close #4680.
* score: Use priority inheritance for thread joinSebastian Huber2022-07-281-24/+57
| | | | | | | | | | | | | | | | | | | | | Threads may join the thread termination of another thread using the pthread_join() or rtems_task_delete() directives. The thread cancel operation used a special case priority boosting mechanism implemented by _Thread_Raise_real_priority(). The problem was that this approach * is not transitive, * does not account for priority adjustments of the calling task while waiting for the join, * does not support clustered scheduling, and * does not detect deadlocks. All these problems are fixed by using a priority inheritance thread queue for the join operation. Close #4679.
* score: Conditional _Thread_Priority_replace()Sebastian Huber2022-07-071-0/+2
| | | | This function is only used in SMP configurations.
* cpukit/include/rtems/score/[s-z]*.h: Change license to BSD-2Joel Sherrill2022-02-281-3/+22
| | | | Updates #3053.
* score: Properly continue the thread during restartSebastian Huber2021-11-231-2/+5
| | | | | | | | | | The _Thread_queue_Extract() does not deal with potential priority updates and the SMP locking protocol handling. Use _Thread_queue_Continue(). For the POSIX signals processing this is currently probably unnecessary, however, the use case is similar to the restart so use the same appoach. Close #4546.
* score: Simplify thread wait state handlingSebastian Huber2021-11-231-11/+8
| | | | | | | | | | Remove the THREAD_WAIT_STATE_READY_AGAIN and simply use the initial value to indicate that a thread does not wait on something. Rename THREAD_WAIT_FLAGS_INITIAL to THREAD_WAIT_STATE_READY. This change is necessary so that _Thread_Continue() can be called for threads which never waited on something (for example dormant threads). Update #4546.
* score: Add _Thread_MP_Extract_proxy()Sebastian Huber2021-11-231-0/+27
| | | | | | | | Remove _Thread_queue_Extract_with_proxy() and move the proxy extraction to _Thread_MP_Extract_proxy(). Move similar code blocks of the previous caller of _Thread_queue_Extract_with_proxy() to helper functions. Update #4546.
* score: Rework ask for help requestsSebastian Huber2021-11-231-26/+0
| | | | | | | | Process ask for help requests on the current processor. This avoids using inter-processor interrupts to make the system behaviour a bit more predictable. Update #4531.
* score: Add SMP scheduler make/clean stickySebastian Huber2021-11-231-8/+20
| | | | | | | | | | | | | | | | | | | | This patch fixes the following broken behaviour: While a thread is scheduled on a helping scheduler, while it does not own a MrsP semaphore, if it obtains a MrsP semaphore, then no scheduler node using an idle thread and the ceiling priority of the semaphore is unblocked for the home scheduler. This could lead to priority inversion issues and is not in line with the MrsP protocol. Introduce two new scheduler operations which are only enabled if RTEMS_SMP is defined. The operations are used to make the scheduler node of the home scheduler sticky and to clean the sticky property. This helps to keep the sticky handing out of the frequently used priority update operation. Close #4532.
* score: Fix thread pinning assertionsSebastian Huber2021-11-151-2/+2
|
* score: Introduce CPU budget operationsSebastian Huber2021-11-151-12/+2
| | | | | | | | | | | | | | This patch set replaces the CPU budget algorithm enumeration with a set of CPU budget operations which implement a particular CPU budget algorithm. This helps to hide the CPU budget algorithm implementation details from the general thread handling. The CPU budget callouts are turned into CPU budget operations. This slightly reduces the size of the thread control block. All schedulers used the default scheduler tick implementation. The tick scheduler operation is removed and the CPU budget operations are directly used in _Watchdog_Tick() if the executing thread uses a CPU budget algorithm. This is performance improvement for all threads which do not use a CPU budget algorithm (default behaviour).
* rtems: Fix rate monotonic statisticsSebastian Huber2021-10-251-7/+33
| | | | | | | | | | | | | | | The rate monotonic period statistics were affected by rtems_cpu_usage_reset(). The logic to detect and work around a CPU usage reset was broken. The Thread_Contol::cpu_time_used is changed to contain the processor time used throughout the entire lifetime of the thread. The new member Thread_Contol::cpu_time_used_at_last_reset is added to contain the processor time used at the time of the last reset through rtems_cpu_usage_reset(). This decouples the resets of the CPU usage and the rate monotonic period statistics. Update #4528.
* score: Always check queue in _Thread_Wait_cancel()Sebastian Huber2021-10-061-2/+2
| | | | | | Commit 18c8a270c296addff87f96b8c248f27eba31c24f removed _Thread_queue_Do_nothing_extract() so we have to check for a non-NULL queue in all configurations.
* score: Delete unused rtems_ada_selfSebastian Huber2021-08-181-5/+0
|
* score: Make zombie registry observableSebastian Huber2021-08-181-0/+27
| | | | | | This helps to write tests for _Thread_Wait_for_execution_stop(). Rename Thread_Zombie_control in Thread_Zombie_registry.
* score: Replace priority prepend it with an enumSebastian Huber2021-08-121-9/+11
| | | | | | | | Use the new Priority_Group_order enum instead of a boolean to indicated if a priority should be inserted as the first or last node into its priority group. This makes the code more expressive. It is also a bit more efficient since a branch in _Scheduler_Node_set_priority() is avoided and a simple bitwise or operation can be used.
* score: Simplify calling _Thread_Exit()Sebastian Huber2021-05-261-7/+6
| | | | | Move common code into _Thread_Exit(). This enables a tail call optimization in most cases.
* score: Improve parameters in _Thread_Change_life()Sebastian Huber2021-05-171-10/+12
|
* rtems: Fix task restart within interrupt contextSebastian Huber2021-05-141-14/+1
| | | | | | | | | | | rtems_task_restart() may be called from within interrupt context. So checking only that the thread to restart is equal to the executing thread is insufficient to determine a self restart. We have to also check that no ISR is in progress. Merge _Thread_Restart_other() and _Thread_Restart_self() into one _Thread_Restart() since they share a lot of common code. Close #4412.
* score: Return status in _Thread_Restart_other()Sebastian Huber2021-05-141-6/+9
| | | | This simplifies rtems_task_restart().
* score: Rename _Stack_Free_nothing()Sebastian Huber2021-05-111-1/+1
| | | | | | | Rename _Stack_Free_nothing() in _Objects_Free_nothing() to make it reusable for the message queue buffers. Update #4007.
* Use alias for rtems_task_self() and pthread_self()Sebastian Huber2021-04-301-0/+7
| | | | This may reduce the code size a bit.
* Return status code for _Thread_Start()Sebastian Huber2021-04-271-4/+3
| | | | | This avoids having conditional statements to get the API-specific status code.
* score: Add Thread_Configuration::cpu_time_budgetSebastian Huber2021-03-161-0/+5
| | | | | Move the CPU time budget to the thread configuration. This simplifies _Thread_Initialize().
* score: Fix thread initializationSebastian Huber2021-02-261-3/+19
| | | | | | | | Close the thread object if a thread create extension fails. Also call the delete extension to avoid resource leaks in early extensions if a late extension fails. Close #4270.
* score: Remove _Objects_Open()Sebastian Huber2021-02-241-2/+2
| | | | | Use the type safe _Objects_Open_u32() instead. Return the object identifier to enforce a common usage pattern.
* score: Add _Thread_Append_post_switch_action()Sebastian Huber2021-02-201-4/+34
| | | | Update #4244.
* score: Add _Thread_Get_objects_information()Sebastian Huber2021-02-011-0/+24
| | | | | | | | | | | | | | | | | | | | | We do not need all the checks if we have a valid indentifier to a thread class object. Using the new _Thread_Get_objects_information() instead of the inline function _Thread_Get_objects_information_by_id() avoids dead code since the identifier in a thread control is always valid and the return NULL path in _Thread_Get_objects_information_by_id() would be dead code. The _Thread_Get_objects_information_by_id() should be an inline function since it is used by _Thread_Get() and thus performance critical. Static analyzers which cannot derive that the identifier in a thread control is always valid, may find a potential NULL pointer access (or otherwise find dead code). The identifier in an object control is always valid, see _Objects_Initialize_information() and _Objects_Extend_information(). Move _RTEMS_tasks_Free() to the only source file which calls this function.
* score: Rename _Thread_Get_objects_information()Sebastian Huber2021-02-011-5/+9
| | | | | | Rename _Thread_Get_objects_information() in _Thread_Get_objects_information_by_id() to emphasize that this thread method uses an object identifier and not a thread control.
* score: Canonicalize Doxygen @file commentsSebastian Huber2020-12-021-4/+2
| | | | | | Use common phrases for the file brief descriptions. Update #3706.
* Remove *_Is_null() inline functionsSebastian Huber2020-10-141-15/+0
| | | | Simply compare the values against NULL.
* rtems: Improve RTEMS_NO_RETURN attributeSebastian Huber2020-10-101-3/+3
| | | | | | | | | | | Provide RTEMS_NO_RETURN also in case RTEMS_DEBUG is defined to prevent errors like this: error: no return statement in function returning non-void [-Werror=return-type] Use C11 and C++11 standard means to declare a no-return function. Close #4122.
* score: Add stack free handler to TCBSebastian Huber2020-08-311-2/+4
| | | | | | | This avoids a dependency to the stack free function in the thread destruction. Update #3959.
* score: Improve _Thread_Start() descriptionSebastian Huber2020-07-211-6/+30
|
* score: Move thread stack allocationSebastian Huber2020-02-121-2/+7
| | | | | | Move thread stack allocation to caller side of _Thread_Initialize(). Update #3835.
* score: Add Thread_ConfigurationSebastian Huber2020-02-121-23/+60
| | | | | | | | | Add the Thread_Configuration structure to reduce the parameter count of _Thread_Initialize(). This makes it easier to add more parameters in the future. It simplifies the code generation since most architectures do not have that many registers available for function parameters. Update #3835.
* score: Simplify thread stack freeSebastian Huber2020-02-121-11/+0
| | | | Update #3835.
* score: Simplify thread stack allocationSebastian Huber2020-02-121-17/+0
| | | | | | Remove superfluous Thread_Control::Start::stack member. Update #3835.
* mpci: Fix blocking proxy statusSebastian Huber2020-01-021-23/+0
| | | | | Remove THREAD_STATUS_PROXY_BLOCKING and replace it with STATUS_PROXY_BLOCKING.
* score: Add and use _Thread_Get_unmapped_priority().Sebastian Huber2019-06-281-0/+28
| | | | Add and use _Thread_Get_unmapped_real_priority().
* doxygen: score: adjust doc in threadimpl.h to doxygen guidelinesAndreas Dachsberger2019-05-131-126/+690
| | | | Update #3706.
* score: Use an ISR lock for Per_CPU_Control::LockSebastian Huber2019-04-121-2/+4
| | | | | | The use of a hand crafted lock for Per_CPU_Control::Lock was necessary at some point in the SMP support development, but it is no longer justified.
* doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber2019-04-041-1/+1
| | | | Update #3706
* score: Static Objects_Information initializationSebastian Huber2018-12-141-20/+2
| | | | | | | | | | | Statically allocate the objects information together with the initial set of objects either via <rtems/confdefs.h>. Provide default object informations with zero objects via librtemscpu.a. This greatly simplifies the workspace size estimate. RTEMS applications which do not use the unlimited objects option are easier to debug since all objects reside now in statically allocated objects of the right types. Close #3621.
* score: Avoid sbintime_t in API headersSebastian Huber2018-12-071-0/+1
| | | | | | | | | | The sbintime_t is a non-POSIX type and not visible if strict standard options are selected. Move implementation details from <rtems/score/timestamp.h> to <rtems/score/timestampimpl.h>. Update #3598.
* score: Remove bogus thread object name supportSebastian Huber2018-10-291-3/+1
| | | | Update #2514.
* score: Add thread pin/unpin supportSebastian Huber2018-09-101-1/+51
| | | | | | | | | Add support to temporarily pin a thread to its current processor. This may be used to access per-processor data structures in critical sections with enabled thread dispatching, e.g. a pinned thread is allowed to block. Update #3508.
* score: Remove redundant #ifdef RTEMS_SMPSebastian Huber2018-08-291-2/+0
|
* score: Avoid structurally dead codeSebastian Huber2018-07-161-3/+2
| | | | This was spotted by Coverity Scan.