summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadrestart.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Mark parameters as intentionally unusedSebastian Huber2024-03-221-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.
* cpukit: Remove unused includesKinsey Moore2023-10-131-2/+0
|
* Update company nameSebastian Huber2023-05-201-1/+1
| | | | | The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
* score: Use PTHREAD_CANCELED for _Thread_Cancel()Sebastian Huber2022-07-281-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.
* score: Use priority inheritance for thread joinSebastian Huber2022-07-281-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.
* score/src/[t-z]*.c: Change license to BSD-2Joel Sherrill2022-02-281-3/+22
| | | | Updates #3053.
* score: Properly continue the thread during restartSebastian Huber2021-11-231-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.
* score: Add _Thread_MP_Extract_proxy()Sebastian Huber2021-11-231-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.
* score: Remove thread timer earlierSebastian Huber2021-11-231-2/+2
| | | | | | | The earlier we remove the thread timer the less likely is a superfluous thread timeout processing. Update #4546.
* score: Introduce CPU budget operationsSebastian Huber2021-11-151-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).
* score: Make zombie registry observableSebastian Huber2021-08-181-16/+13
| | | | | | This helps to write tests for _Thread_Wait_for_execution_stop(). Rename Thread_Zombie_control in Thread_Zombie_registry.
* score: Simplify _Thread_Kill_zombies()Sebastian Huber2021-08-181-8/+11
|
* score: Replace priority prepend it with an enumSebastian Huber2021-08-121-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.
* score: Direct thread dispatch in a self restartSebastian Huber2021-05-261-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.
* score: Fix _Thread_Cancel()Sebastian Huber2021-05-261-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.
* score: Simplify calling _Thread_Exit()Sebastian Huber2021-05-261-5/+13
| | | | | Move common code into _Thread_Exit(). This enables a tail call optimization in most cases.
* score: Add and use _Per_CPU_Is_ISR_in_progress()Sebastian Huber2021-05-171-1/+1
| | | | | Add _Per_CPU_Is_ISR_in_progress() as an optimized version of _ISR_Is_in_progress().
* score: Improve parameters in _Thread_Change_life()Sebastian Huber2021-05-171-12/+17
|
* rtems: Fix task restart within interrupt contextSebastian Huber2021-05-141-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.
* rtems: Always set the real priority during restartSebastian Huber2021-05-141-26/+32
| | | | | | | Unconditionally set the real priority of the task to its initial priority during a task restart. Close #4411.
* score: Return status in _Thread_Restart_other()Sebastian Huber2021-05-141-3/+3
| | | | This simplifies rtems_task_restart().
* score: Add _Thread_Dispatch_direct_no_return()Sebastian Huber2021-05-021-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.
* Remove superfluous <rtems/score/wkspace.h> includesSebastian Huber2021-04-201-1/+0
|
* score: Fix thread initializationSebastian Huber2021-02-261-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.
* score: Add _Thread_Get_objects_information()Sebastian Huber2021-02-011-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.
* score: Canonicalize Doxygen @file commentsSebastian Huber2020-12-021-1/+4
| | | | | | Use common phrases for the file brief descriptions. Update #3706.
* score: Add stack free handler to TCBSebastian Huber2020-08-311-1/+1
| | | | | | | This avoids a dependency to the stack free function in the thread destruction. Update #3959.
* score: Use _Freechain_Push()Sebastian Huber2020-08-311-1/+1
| | | | | | The nodes are never NULL. Update #3959.
* score: Add <rtems/score/freechainimpl.h>Sebastian Huber2020-08-311-0/+1
| | | | | | Hide implementation details. Update #3959.
* score: Fix debug assertSebastian Huber2020-08-311-4/+12
| | | | | Do not access executing->current_state outside the protection of the thread state lock. Add missing state with a comment.
* doxygen: Switch @brief and @ingroupSebastian Huber2020-04-281-1/+2
| | | | This order change fixes the Latex documentation build via Doxygen.
* Canonicalize config.h includeSebastian Huber2020-04-161-1/+1
| | | | | | | | Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
* score: Simplify TLS area allocationSebastian Huber2020-02-121-2/+0
| | | | | | Use the stack area to allocate the TLS area. Update #3835.
* score: Simplify FP context allocationSebastian Huber2020-02-121-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.
* score: Simplify thread stack freeSebastian Huber2020-02-121-1/+2
| | | | Update #3835.
* doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber2019-04-041-1/+1
| | | | Update #3706
* score: Static Objects_Information initializationSebastian Huber2018-12-141-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.
* posix: Provide threads by defaultSebastian Huber2018-10-291-16/+0
| | | | Update #2514.
* Use _Thread_Dispatch_direct()Sebastian Huber2018-02-081-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.
* score: Move thread queue timeout handlingSebastian Huber2017-10-241-1/+1
| | | | | Update #3117. Update #3182.
* score: Add optional _CPU_Context_Destroy()Sebastian Huber2017-07-251-1/+1
| | | | Update #3077.
* score: Introduce _Internal_error()Sebastian Huber2016-12-121-1/+1
|
* score: Remove fatal is internal indicatorSebastian Huber2016-12-091-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.
* score: Initialize thread queue context earlySebastian Huber2016-12-021-2/+4
| | | | | | | | Initialize thread queue context early preferably outside the critical section. Remove implicit _Thread_queue_Context_initialize() from _Thread_Wait_acquire().
* score: Fix thread queue context initializationSebastian Huber2016-11-281-1/+1
| | | | | Initialize the thread queue context with invalid data in debug configurations to catch missing set up steps.
* score: Optimize _Thread_queue_Enqueue()Sebastian Huber2016-11-241-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.
* score: Rename _Thread_queue_Enqueue_critical()Sebastian Huber2016-11-231-1/+1
| | | | | Delete unused _Thread_queue_Enqueue() and rename _Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
* score: Add thread queue enqueue calloutSebastian Huber2016-11-231-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.
* score: Add and use _Thread_Dispatch_direct()Sebastian Huber2016-11-181-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.
* score: Conditionally enable thread resource countSebastian Huber2016-11-031-0/+2
| | | | | Maintain the thread resource count only in debug configurations. This is a performance optimization for non-debug configurations.