summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadrestart.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-03-22Mark parameters as intentionally unusedSebastian Huber1-0/+1
The parameters are unused due to API constraints. The functions are used through function pointers. Alternative implementations may use the parameters. Update #4862.
2023-10-13cpukit: Remove unused includesKinsey Moore1-2/+0
2023-05-20Update company nameSebastian Huber1-1/+1
The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
2022-07-28score: Use PTHREAD_CANCELED for _Thread_Cancel()Sebastian Huber1-5/+5
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.
2022-07-28score: Use priority inheritance for thread joinSebastian Huber1-68/+58
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.
2022-02-28score/src/[t-z]*.c: Change license to BSD-2Joel Sherrill1-3/+22
Updates #3053.
2021-11-23score: Properly continue the thread during restartSebastian Huber1-3/+3
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.
2021-11-23score: Add _Thread_MP_Extract_proxy()Sebastian Huber1-5/+3
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.
2021-11-23score: Remove thread timer earlierSebastian Huber1-2/+2
The earlier we remove the thread timer the less likely is a superfluous thread timeout processing. Update #4546.
2021-11-15score: Introduce CPU budget operationsSebastian Huber1-4/+0
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).
2021-08-18score: Make zombie registry observableSebastian Huber1-16/+13
This helps to write tests for _Thread_Wait_for_execution_stop(). Rename Thread_Zombie_control in Thread_Zombie_registry.
2021-08-18score: Simplify _Thread_Kill_zombies()Sebastian Huber1-8/+11
2021-08-12score: Replace priority prepend it with an enumSebastian Huber1-2/+2
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.
2021-05-26score: Direct thread dispatch in a self restartSebastian Huber1-5/+11
Commit 73ebf9a27ed5cd0fd3e0dc0da98345d7faa610a2 accidentally removed the direct thread dispatch in a self thread restart. In case of a self restart (always in task context) the directive shall not return. If this is not possible due to a bad thread dispatch disable level, then a fatal error shall occur. Update #4412.
2021-05-26score: Fix _Thread_Cancel()Sebastian Huber1-26/+22
The _Thread_Cancel() (in contrast to _Thread_Restart() which used a similar code block) may have produced ready threads with an active timer in case the thread to cancel had its thread life protection enabled. The problem was this code block: Priority_Control priority; _Thread_Add_life_change_request( the_thread ); if ( _Thread_Is_life_change_allowed( previous ) ) { _Thread_State_release( the_thread, &lock_context ); _Thread_queue_Extract_with_proxy( the_thread ); _Thread_Timer_remove( the_thread ); } else { _Thread_Clear_state_locked( the_thread, STATES_SUSPENDED ); _Thread_State_release( the_thread, &lock_context ); } priority = _Thread_Get_priority( executing ); _Thread_Raise_real_priority( the_thread, priority ); _Thread_Remove_life_change_request( the_thread ); The life change request should only be added/removed if a life change is allowed (see _Thread_Restart()). Add _Thread_Try_life_change_request() and use it in _Thread_Cancel() and _Thread_Restart(). Close #4435.
2021-05-26score: Simplify calling _Thread_Exit()Sebastian Huber1-5/+13
Move common code into _Thread_Exit(). This enables a tail call optimization in most cases.
2021-05-17score: Add and use _Per_CPU_Is_ISR_in_progress()Sebastian Huber1-1/+1
Add _Per_CPU_Is_ISR_in_progress() as an optimized version of _ISR_Is_in_progress().
2021-05-17score: Improve parameters in _Thread_Change_life()Sebastian Huber1-12/+17
2021-05-14rtems: Fix task restart within interrupt contextSebastian Huber1-53/+15
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.
2021-05-14rtems: Always set the real priority during restartSebastian Huber1-26/+32
Unconditionally set the real priority of the task to its initial priority during a task restart. Close #4411.
2021-05-14score: Return status in _Thread_Restart_other()Sebastian Huber1-3/+3
This simplifies rtems_task_restart().
2021-05-02score: Add _Thread_Dispatch_direct_no_return()Sebastian Huber1-2/+2
The __builtin_unreachable() cannot be used with current GCC versions to tell the compiler that a function does not return to the caller, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99151 Add a no return variant of _Thread_Dispatch_direct() to avoid generation of dead code.
2021-04-20Remove superfluous <rtems/score/wkspace.h> includesSebastian Huber1-1/+0
2021-02-26score: Fix thread initializationSebastian Huber1-47/+4
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.
2021-02-01score: Add _Thread_Get_objects_information()Sebastian Huber1-6/+6
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.
2020-12-02score: Canonicalize Doxygen @file commentsSebastian Huber1-1/+4
Use common phrases for the file brief descriptions. Update #3706.
2020-08-31score: Add stack free handler to TCBSebastian Huber1-1/+1
This avoids a dependency to the stack free function in the thread destruction. Update #3959.
2020-08-31score: Use _Freechain_Push()Sebastian Huber1-1/+1
The nodes are never NULL. Update #3959.
2020-08-31score: Add <rtems/score/freechainimpl.h>Sebastian Huber1-0/+1
Hide implementation details. Update #3959.
2020-08-31score: Fix debug assertSebastian Huber1-4/+12
Do not access executing->current_state outside the protection of the thread state lock. Add missing state with a comment.
2020-04-28doxygen: Switch @brief and @ingroupSebastian Huber1-1/+2
This order change fixes the Latex documentation build via Doxygen.
2020-04-16Canonicalize config.h includeSebastian Huber1-1/+1
Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
2020-02-12score: Simplify TLS area allocationSebastian Huber1-2/+0
Use the stack area to allocate the TLS area. Update #3835.
2020-02-12score: Simplify FP context allocationSebastian Huber1-2/+0
Use the stack area to allocate the FP context. This considerably simplifies the application configuration since the task count no longer influences the configured work space size. With this change the stack space size is overestimated since an FP context for each thread is accounted. Memory constraint applications can use the stack size for fine tuning. Update #3835.
2020-02-12score: Simplify thread stack freeSebastian Huber1-1/+2
Update #3835.
2019-04-04doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber1-1/+1
Update #3706
2018-12-14score: Static Objects_Information initializationSebastian Huber1-1/+1
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.
2018-10-29posix: Provide threads by defaultSebastian Huber1-16/+0
Update #2514.
2018-02-08Use _Thread_Dispatch_direct()Sebastian Huber1-2/+2
Use _Thread_Dispatch_direct() for operations that block the executing thread. This ensures that we get a fatal error (INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL) if we try to block in an invalid context, e.g. during system start or an interrupt handler.
2017-10-24score: Move thread queue timeout handlingSebastian Huber1-1/+1
Update #3117. Update #3182.
2017-07-25score: Add optional _CPU_Context_Destroy()Sebastian Huber1-1/+1
Update #3077.
2016-12-12score: Introduce _Internal_error()Sebastian Huber1-1/+1
2016-12-09score: Remove fatal is internal indicatorSebastian Huber1-5/+1
The fatal is internal indicator is redundant since the fatal source and error code uniquely identify a fatal error. Keep the fatal user extension is internal parameter for backward compatibility and set it to false always. Update #2825.
2016-12-02score: Initialize thread queue context earlySebastian Huber1-2/+4
Initialize thread queue context early preferably outside the critical section. Remove implicit _Thread_queue_Context_initialize() from _Thread_Wait_acquire().
2016-11-28score: Fix thread queue context initializationSebastian Huber1-1/+1
Initialize the thread queue context with invalid data in debug configurations to catch missing set up steps.
2016-11-24score: Optimize _Thread_queue_Enqueue()Sebastian Huber1-1/+1
Move thread state for _Thread_queue_Enqueue() to the thread queue context. This reduces the parameter count of _Thread_queue_Enqueue() from five to four (ARM for example has only four function parameter registers). Since the thread state is used after several function calls inside _Thread_queue_Enqueue() this parameter was saved on the stack previously.
2016-11-23score: Rename _Thread_queue_Enqueue_critical()Sebastian Huber1-1/+1
Delete unused _Thread_queue_Enqueue() and rename _Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
2016-11-23score: Add thread queue enqueue calloutSebastian Huber1-8/+27
Replace the expected thread dispatch disable level with a thread queue enqueue callout. This enables the use of _Thread_Dispatch_direct() in the thread queue enqueue procedure. This avoids impossible exection paths, e.g. Per_CPU_Control::dispatch_necessary is always true.
2016-11-18score: Add and use _Thread_Dispatch_direct()Sebastian Huber1-7/+1
This function is useful for operations which synchronously block, e.g. self restart, self deletion, yield, sleep. It helps to detect if these operations are called in the wrong context. Since the thread dispatch necessary indicator is not used, this is more robust in some SMP situations. Update #2751.
2016-11-03score: Conditionally enable thread resource countSebastian Huber1-0/+2
Maintain the thread resource count only in debug configurations. This is a performance optimization for non-debug configurations.