summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/threadqimpl.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-09-19Do not use RTEMS_INLINE_ROUTINESebastian Huber1-35/+35
Directly use "static inline" which is available in C99 and later. This brings the RTEMS implementation closer to standard C. Close #3935.
2022-02-28cpukit/include/rtems/score/[s-z]*.h: Change license to BSD-2Joel Sherrill1-3/+22
Updates #3053.
2021-11-23score: Move _Thread_queue_Extract()Sebastian Huber1-1/+6
Move _Thread_queue_Extract() since this function is not used by the core services (threads, semaphores, mutexes, message queues). Update #4546.
2021-11-23score: Add _Thread_MP_Extract_proxy()Sebastian Huber1-18/+0
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-10-01score: Add Thread_queue_Deadlock_statusSebastian Huber1-11/+39
Replace the boolen return value with the new enum Thread_queue_Deadlock_status. This improves the code readability. Improve documentation. Shorten function names.
2021-09-03score: Document thread queue operationsSebastian Huber1-0/+21
2021-09-01score: Update priority only if necessarySebastian Huber1-2/+2
In _Thread_queue_Flush_critical(), update the priority of the thread queue owner only if necessary. The scheduler update priority operation could be expensive.
2021-09-01score: Remove _Thread_queue_Unblock_critical()Sebastian Huber1-28/+6
This function was only used in one place. Replace it with a call to _Thread_queue_Resume().
2021-09-01score: Remove _Thread_queue_First_locked()Sebastian Huber1-28/+0
The _Thread_queue_First_locked() was only used in one place. Move the code of this inline function to this place.
2021-09-01score: Fix blocking message queue receiveSebastian Huber1-46/+13
In order to ensure FIFO fairness across schedulers, the thread queue surrender operation must be used to dequeue a thread from the thread queue. The thread queue extract operation is intended for timeouts. Add _Thread_queue_Resume() which may be used to make extracted or surrendered threads ready again. Remove the now unused _Thread_queue_Extract_critical() function. Close #4509.
2021-09-01score: Fix priority discipline handlingSebastian Huber1-0/+43
The priority queues in clustered scheduling configurations use a per scheduler priority queue rotation to ensure FIFO fairness across schedulers. This mechanism is implemented in the thread queue surrender operation. Unfortunately some semaphore and message queue directives used wrongly the thread queue extract operation. Fix this through the use of _Thread_queue_Surrender(). Update #4358.
2021-06-10score: Fix initialization of thread queue contextSebastian Huber1-3/+9
Set Thread_queue_Context::timeout_absolute in _Thread_queue_Context_set_timeout_argument() to avoid using it uninitialized. The bug was introduced by a89ecaa1a94d49ddae7753d6b83923e9d2a00486.
2021-05-18score: Simplify thread queue timeout handlingSebastian Huber1-12/+24
Add Thread_queue_Context::timeout_absolute to specify an absolute or relative timeout. This avoid having to get the current time twice for timeouts relative to the current time. It moves also functionality to common code.
2021-04-20score: Remove unused _Thread_queue_Dequeue()Sebastian Huber1-51/+0
Last use was removed by: commit 54550e048d3a49435912797d2024f80671e93267 Author: Sebastian Huber <sebastian.huber@embedded-brains.de> Date: Fri May 13 08:16:30 2016 +0200 posix: Rework pthread_join() Rework pthread_join() to use _Thread_Join().
2020-12-02score: Canonicalize Doxygen @file commentsSebastian Huber1-5/+7
Use common phrases for the file brief descriptions. Update #3706.
2019-05-13doxygen: score: adjust doc in threadqimpl.h to doxygen guidelinesAndreas Dachsberger1-77/+317
Update #3706.
2019-04-04doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber1-1/+1
Update #3706
2019-02-28Remove explicit file names from @fileSebastian Huber1-1/+1
This makes the @file documentation independent of the actual file name. Update #3707.
2018-10-05score: Fix legacy RTEMS_STATIC_ASSERT()Sebastian Huber1-2/+2
In standard C pointer operands are not allowed in integer constant expressions. Avoid a static assertion based on an array typedef since this could lead to warnings ("variably modified 'x' at file scope" and "typedef 'x' locally defined but not used"); This implementation requires unique messages.
2018-01-25Remove make preinstallChris Johns1-0/+0
A speciality of the RTEMS build system was the make preinstall step. It copied header files from arbitrary locations into the build tree. The header files were included via the -Bsome/build/tree/path GCC command line option. This has at least seven problems: * The make preinstall step itself needs time and disk space. * Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error. * There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult. * The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit. * An introduction of a new build system is difficult. * Include paths specified by the -B option are system headers. This may suppress warnings. * The parallel build had sporadic failures on some hosts. This patch removes the make preinstall step. All installed header files are moved to dedicated include directories in the source tree. Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc, etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g. erc32, imx, qoriq, etc. The new cpukit include directories are: * cpukit/include * cpukit/score/cpu/@RTEMS_CPU@/include * cpukit/libnetworking The new BSP include directories are: * bsps/include * bsps/@RTEMS_CPU@/include * bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include There are build tree include directories for generated files. The include directory order favours the most general header file, e.g. it is not possible to override general header files via the include path order. The "bootstrap -p" option was removed. The new "bootstrap -H" option should be used to regenerate the "headers.am" files. Update #3254.
2017-10-24score: Move thread queue timeout handlingSebastian Huber1-25/+85
Update #3117. Update #3182.
2017-10-24score: Rename function threadq support functionSebastian Huber1-5/+5
Rename _Thread_queue_Context_set_do_nothing_enqueue_callout() into _Thread_queue_Context_set_enqueue_do_nothing_extra(). More _Thread_queue_Context_set_enqueue_*() functions will follow. Update #3117. Update #3182.
2017-10-10score: Add _Thread_queue_Dispatch_disable()Sebastian Huber1-0/+10
2017-07-31score: Add RTEMS_HAVE_MEMBER_SAME_TYPE()Sebastian Huber1-2/+6
This fixes some "variably modified" warnings and a clang compile error.
2017-01-31score: Add _Thread_queue_Object_nameSebastian Huber1-2/+46
Add the special thread queue name _Thread_queue_Object_name to mark thread queues embedded in an object with identifier. Using the special thread state STATES_THREAD_QUEUE_WITH_IDENTIFIER is not reliable for this purpose since the thread wait information and thread state are protected by different SMP locks in separate critical sections. Remove STATES_THREAD_QUEUE_WITH_IDENTIFIER. Add and use _Thread_queue_Object_initialize(). Update #2858.
2017-01-13score: Add Thread_queue_Queue::nameSebastian Huber1-12/+26
Update #2858.
2017-01-11score: Improve SMP lock debug supportSebastian Huber1-1/+1
The CPU index starts with zero. Increment it by one, to allow global SMP locks to reside in the BSS section.
2016-12-02score: Fix debug thread queue context initSebastian Huber1-0/+2
On ARM Thumb we may have function addresses ending with 0x7f, if we are lucky.
2016-11-28score: Fix thread queue context initializationSebastian Huber1-3/+4
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-8/+44
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-48/+10
Delete unused _Thread_queue_Enqueue() and rename _Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
2016-11-23score: Add thread queue enqueue calloutSebastian Huber1-10/+35
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: Optimize self-contained objectsSebastian Huber1-0/+19
Avoid use of the stack for the hot paths.
2016-11-04score: Use non-inline thread queue lock opsSebastian Huber1-19/+35
This reduces the code size and helps to reduce the amount of testing. Hot paths can use the _Thread_queue_Queue_acquire_critical() and _Thread_queue_Queue_release_critical() functions which are still inline.
2016-11-02score: First part of new MrsP implementationSebastian Huber1-0/+62
Update #2556.
2016-09-21score: Scheduler node awareness for thread queuesSebastian Huber1-3/+3
Maintain the priority of a thread for each scheduler instance via the thread queue enqueue, extract, priority actions and surrender operations. This replaces the primitive priority boosting. Update #2556.
2016-09-21score: Rework thread priority managementSebastian Huber1-80/+65
Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
2016-09-08score: Introduce Thread_queue_Lock_contextSebastian Huber1-6/+6
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.
2016-09-08score: Simplify thread queue acquire/releaseSebastian Huber1-10/+32
2016-08-11score: Introduce thread queue surrender operationSebastian Huber1-25/+0
This is an optimization for _Thread_queue_Surrender(). It helps to encapsulate the priority boosting in the priority inheritance thread queue operations.
2016-08-11score: Add _Thread_queue_Surrender()Sebastian Huber1-0/+27
Add _Thread_queue_Surrender() to unify the mutex surrender procedures which involve a thread queue operation.
2016-08-03score: Fix and simplify thread wait locksSebastian Huber1-106/+6
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.
2016-07-27score: Add deadlock detectionSebastian Huber1-0/+38
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.
2016-07-27score: Turn thread lock into thread wait lockSebastian Huber1-3/+145
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.
2016-07-27score: Priority inherit thread queue operationsSebastian Huber1-0/+23
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.
2016-07-26cpukit: refactor nanosleep and use 64-bit timeout for threadqGedare Bloom1-1/+1
* Fixes a bug with elapsed time calculations misusing absolute time arguments in nanosleep_helper by passing the requested relative interval. * Fixes a bug with truncation of absolute timeouts by passing the full 64-bit value to Thread_queue_Enqueue. * Share yield logic between nanosleep and clock_nanosleep. updates #2732
2016-07-25cpukit: Add and use Watchdog_Discipline.Gedare Bloom1-7/+60
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
2016-07-22score: Add debug support to chainsSebastian Huber1-0/+2
This helps to detect * double insert, append, prepend errors, and * get from empty chain errors.
2016-05-30score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber1-12/+38
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().
2016-05-30score: Add _Thread_queue_Context_set_MP_callout()Sebastian Huber1-25/+22
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.