summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r--cpukit/score/include/rtems/score/corebarrierimpl.h42
-rw-r--r--cpukit/score/include/rtems/score/coremsgimpl.h45
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h146
-rw-r--r--cpukit/score/include/rtems/score/corerwlockimpl.h32
-rw-r--r--cpukit/score/include/rtems/score/coresemimpl.h69
-rw-r--r--cpukit/score/include/rtems/score/corespinlockimpl.h36
-rw-r--r--cpukit/score/include/rtems/score/mpciimpl.h11
-rw-r--r--cpukit/score/include/rtems/score/mrsp.h31
-rw-r--r--cpukit/score/include/rtems/score/mrspimpl.h49
-rw-r--r--cpukit/score/include/rtems/score/status.h129
-rw-r--r--cpukit/score/include/rtems/score/thread.h5
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h22
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h40
13 files changed, 281 insertions, 376 deletions
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 051990e818..d2d9997d95 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -20,6 +20,7 @@
#define _RTEMS_SCORE_COREBARRIERIMPL_H
#include <rtems/score/corebarrier.h>
+#include <rtems/score/status.h>
#include <rtems/score/threadqimpl.h>
#ifdef __cplusplus
@@ -31,35 +32,6 @@ extern "C" {
*/
/**@{**/
-/**
- * Core Barrier handler return statuses.
- */
-typedef enum {
- /** This status indicates that the operation completed successfully. */
- CORE_BARRIER_STATUS_SUCCESSFUL,
- /** This status indicates that the barrier is configured for automatic
- * release and the caller tripped the automatic release. The caller
- * thus did not block.
- */
- CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED,
- /** This status indicates that the thread was blocked waiting for an
- * operation to complete and the barrier was deleted.
- */
- CORE_BARRIER_WAS_DELETED,
- /** This status indicates that the calling task was willing to block
- * but the operation was unable to complete within the time allotted
- * because the resource never became available.
- */
- CORE_BARRIER_TIMEOUT
-} CORE_barrier_Status;
-
-/**
- * @brief Core barrier last status value.
- *
- * This is the last status value.
- */
-#define CORE_BARRIER_STATUS_LAST CORE_BARRIER_TIMEOUT
-
#define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
/**
@@ -120,9 +92,9 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Release(
* @param[in] mp_callout is the routine to invoke if the
* thread unblocked is remote
*
- * @note Status is returned via the thread control block.
+ * @return The method status.
*/
-void _CORE_barrier_Seize(
+Status_Control _CORE_barrier_Seize(
CORE_barrier_Control *the_barrier,
Thread_Control *executing,
bool wait,
@@ -160,12 +132,6 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_barrier_Surrender(
);
}
-Thread_Control *_CORE_barrier_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- Thread_queue_Context *queue_context
-);
-
RTEMS_INLINE_ROUTINE void _CORE_barrier_Flush(
CORE_barrier_Control *the_barrier,
Thread_queue_Context *queue_context
@@ -173,7 +139,7 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Flush(
{
_CORE_barrier_Do_flush(
the_barrier,
- _CORE_barrier_Was_deleted,
+ _Thread_queue_Flush_status_object_was_deleted,
queue_context
);
}
diff --git a/cpukit/score/include/rtems/score/coremsgimpl.h b/cpukit/score/include/rtems/score/coremsgimpl.h
index 30abe0470e..d240c4a405 100644
--- a/cpukit/score/include/rtems/score/coremsgimpl.h
+++ b/cpukit/score/include/rtems/score/coremsgimpl.h
@@ -20,6 +20,7 @@
#define _RTEMS_SCORE_COREMSGIMPL_H
#include <rtems/score/coremsg.h>
+#include <rtems/score/status.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/threaddispatch.h>
#include <rtems/score/threadqimpl.h>
@@ -65,40 +66,6 @@ extern "C" {
typedef int CORE_message_queue_Submit_types;
/**
- * @brief The possible set of Core Message Queue handler return statuses.
- *
- * This enumerated type defines the possible set of Core Message
- * Queue handler return statuses.
- */
-typedef enum {
- /** This value indicates the operation completed sucessfully. */
- CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL,
- /** This value indicates that the message was too large for this queue. */
- CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE,
- /** This value indicates that there are too many messages pending. */
- CORE_MESSAGE_QUEUE_STATUS_TOO_MANY,
- /** This value indicates that a receive was unsuccessful. */
- CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED,
- /** This value indicates that a blocking send was unsuccessful. */
- CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT,
- /** This value indicates that the message queue being blocked upon
- * was deleted while the thread was waiting.
- */
- CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
- /** This value indicates that the thread had to timeout while waiting
- * to receive a message because one did not become available.
- */
- CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
-} CORE_message_queue_Status;
-
-/**
- * @brief Core message queue last status value.
- *
- * This is the last status value.
- */
-#define CORE_MESSAGE_QUEUE_STATUS_LAST CORE_MESSAGE_QUEUE_STATUS_TIMEOUT
-
-/**
* @brief Initialize a message queue.
*
* This package is the implementation of the CORE Message Queue Handler.
@@ -202,7 +169,7 @@ uint32_t _CORE_message_queue_Flush(
* @retval @a *count will contain the number of messages sent
* @retval indication of the successful completion or reason for failure
*/
-CORE_message_queue_Status _CORE_message_queue_Broadcast(
+Status_Control _CORE_message_queue_Broadcast(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
@@ -233,7 +200,7 @@ CORE_message_queue_Status _CORE_message_queue_Broadcast(
* _CORE_message_queue_Acquire() or _CORE_message_queue_Acquire_critical().
* @retval indication of the successful completion or reason for failure
*/
-CORE_message_queue_Status _CORE_message_queue_Submit(
+Status_Control _CORE_message_queue_Submit(
CORE_message_queue_Control *the_message_queue,
Thread_Control *executing,
const void *buffer,
@@ -278,7 +245,7 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
* + available
* + wait
*/
-void _CORE_message_queue_Seize(
+Status_Control _CORE_message_queue_Seize(
CORE_message_queue_Control *the_message_queue,
Thread_Control *executing,
void *buffer,
@@ -309,7 +276,7 @@ void _CORE_message_queue_Insert_message(
CORE_message_queue_Submit_types submit_type
);
-RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Send(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
@@ -330,7 +297,7 @@ RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
);
}
-RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_message_queue_Urgent(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index a32022aa23..f5faf9517a 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -20,6 +20,7 @@
#include <rtems/score/coremutex.h>
#include <rtems/score/chainimpl.h>
+#include <rtems/score/status.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
@@ -34,53 +35,6 @@ extern "C" {
/**@{**/
/**
- * @brief The possible Mutex handler return statuses.
- *
- * This enumerated type defines the possible Mutex handler return statuses.
- */
-typedef enum {
- /** This status indicates that the operation completed successfully. */
- CORE_MUTEX_STATUS_SUCCESSFUL,
- /** This status indicates that the calling task did not want to block
- * and the operation was unable to complete immediately because the
- * resource was unavailable.
- */
- CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
-#if defined(RTEMS_POSIX_API)
- /** This status indicates that an attempt was made to relock a mutex
- * for which nesting is not configured.
- */
- CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
-#endif
- /** This status indicates that an attempt was made to release a mutex
- * by a thread other than the thread which locked it.
- */
- CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE,
- /** This status indicates that the thread was blocked waiting for an
- * operation to complete and the mutex was deleted.
- */
- CORE_MUTEX_WAS_DELETED,
- /** This status indicates that the calling task was willing to block
- * but the operation was unable to complete within the time allotted
- * because the resource never became available.
- */
- CORE_MUTEX_TIMEOUT,
-
- /** This status indicates that a thread of logically greater importance
- * than the ceiling priority attempted to lock this mutex.
- */
- CORE_MUTEX_STATUS_CEILING_VIOLATED
-
-} CORE_mutex_Status;
-
-/**
- * @brief The last status value.
- *
- * This is the last status value.
- */
-#define CORE_MUTEX_STATUS_LAST CORE_MUTEX_STATUS_CEILING_VIOLATED
-
-/**
* @brief Initializes the mutex based on the parameters passed.
*
* This routine initializes the mutex based on the parameters passed.
@@ -92,9 +46,9 @@ typedef enum {
* @param[in] initially_locked If true, then the mutex is initially locked by
* the executing thread.
*
- * @retval This method returns CORE_MUTEX_STATUS_SUCCESSFUL if successful.
+ * @retval This method returns STATUS_SUCCESSFUL if successful.
*/
-CORE_mutex_Status _CORE_mutex_Initialize(
+Status_Control _CORE_mutex_Initialize(
CORE_mutex_Control *the_mutex,
Thread_Control *executing,
const CORE_mutex_Attributes *the_mutex_attributes,
@@ -140,7 +94,7 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Release(
* @param[in] timeout is the maximum number of ticks to block
* @param[in] lock_context is the interrupt level
*/
-void _CORE_mutex_Seize_interrupt_blocking(
+Status_Control _CORE_mutex_Seize_interrupt_blocking(
CORE_mutex_Control *the_mutex,
Thread_Control *executing,
Watchdog_Interval timeout,
@@ -227,12 +181,10 @@ RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority_ceiling(
* @param[in,out] the_mutex is the mutex to attempt to lock
* @param[in] queue_context is the interrupt level
*
- * @retval This routine returns 0 if "trylock" can resolve whether or not
- * the mutex is immediately obtained or there was an error attempting to
- * get it. It returns 1 to indicate that the caller cannot obtain
- * the mutex and will have to block to do so.
+ * @retval STATUS_UNAVAILABLE The mutex is already locked.
+ * @retval other Otherwise.
*/
-RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_mutex_Seize_interrupt_trylock(
CORE_mutex_Control *the_mutex,
Thread_Control *executing,
Thread_queue_Context *queue_context
@@ -240,7 +192,6 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
{
/* disabled when you get here */
- executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
if ( !_CORE_mutex_Is_locked( the_mutex ) ) {
the_mutex->holder = executing;
the_mutex->nest_count = 1;
@@ -251,13 +202,13 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
_CORE_mutex_Release( the_mutex, queue_context );
- return 0;
- } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+ } else {
+ /*
+ * must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
*
* we possibly bump the priority of the current holder -- which
* happens to be _Thread_Executing.
*/
- {
Priority_Control ceiling;
Priority_Control current;
@@ -265,10 +216,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
current = executing->current_priority;
if ( current == ceiling ) {
_CORE_mutex_Release( the_mutex, queue_context );
- return 0;
- }
-
- if ( current > ceiling ) {
+ } else if ( current > ceiling ) {
Per_CPU_Control *cpu_self;
cpu_self = _Thread_Dispatch_disable_critical(
@@ -277,18 +225,16 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
_CORE_mutex_Release( the_mutex, queue_context );
_Thread_Raise_priority( executing, ceiling );
_Thread_Dispatch_enable( cpu_self );
- return 0;
- }
- /* if ( current < ceiling ) */ {
- executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
+ } else /* if ( current < ceiling ) */ {
the_mutex->holder = NULL;
the_mutex->nest_count = 0; /* undo locking above */
executing->resource_count--; /* undo locking above */
_CORE_mutex_Release( the_mutex, queue_context );
- return 0;
+ return STATUS_MUTEX_CEILING_VIOLATED;
}
}
- return 0;
+
+ return STATUS_SUCCESSFUL;
}
/*
@@ -301,12 +247,11 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
case CORE_MUTEX_NESTING_ACQUIRES:
the_mutex->nest_count++;
_CORE_mutex_Release( the_mutex, queue_context );
- return 0;
+ return STATUS_SUCCESSFUL;
#if defined(RTEMS_POSIX_API)
case CORE_MUTEX_NESTING_IS_ERROR:
- executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
_CORE_mutex_Release( the_mutex, queue_context );
- return 0;
+ return STATUS_NESTING_NOT_ALLOWED;
#endif
case CORE_MUTEX_NESTING_BLOCKS:
break;
@@ -317,7 +262,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
* The mutex is not available and the caller must deal with the possibility
* of blocking.
*/
- return 1;
+ return STATUS_UNAVAILABLE;
}
/**
@@ -346,7 +291,7 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
* * If the caller is willing to wait
* then they are blocked.
*/
-RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_mutex_Seize(
CORE_mutex_Control *the_mutex,
Thread_Control *executing,
bool wait,
@@ -354,6 +299,8 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize(
Thread_queue_Context *queue_context
)
{
+ Status_Control status;
+
if ( _CORE_mutex_Check_dispatch_for_seize( wait ) ) {
_Terminate(
INTERNAL_ERROR_CORE,
@@ -361,39 +308,34 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize(
INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
);
}
+
_CORE_mutex_Acquire_critical( the_mutex, queue_context );
- if (
- _CORE_mutex_Seize_interrupt_trylock( the_mutex, executing, queue_context )
- ) {
- if ( !wait ) {
- _CORE_mutex_Release( the_mutex, queue_context );
- executing->Wait.return_code =
- CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
- } else {
- _CORE_mutex_Seize_interrupt_blocking(
- the_mutex,
- executing,
- timeout,
- &queue_context->Lock_context
- );
- }
+
+ status = _CORE_mutex_Seize_interrupt_trylock(
+ the_mutex,
+ executing,
+ queue_context
+ );
+
+ if ( status != STATUS_UNAVAILABLE ) {
+ return status;
}
-}
-CORE_mutex_Status _CORE_mutex_Surrender(
- CORE_mutex_Control *the_mutex,
- Thread_queue_Context *queue_context
-);
+ if ( !wait ) {
+ _CORE_mutex_Release( the_mutex, queue_context );
+ return status;
+ }
-Thread_Control *_CORE_mutex_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- Thread_queue_Context *queue_context
-);
+ return _CORE_mutex_Seize_interrupt_blocking(
+ the_mutex,
+ executing,
+ timeout,
+ &queue_context->Lock_context
+ );
+}
-Thread_Control *_CORE_mutex_Unsatisfied_nowait(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
+Status_Control _CORE_mutex_Surrender(
+ CORE_mutex_Control *the_mutex,
Thread_queue_Context *queue_context
);
diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h b/cpukit/score/include/rtems/score/corerwlockimpl.h
index 67084c136a..e80ab0ef0c 100644
--- a/cpukit/score/include/rtems/score/corerwlockimpl.h
+++ b/cpukit/score/include/rtems/score/corerwlockimpl.h
@@ -22,6 +22,7 @@
#include <rtems/score/corerwlock.h>
#include <rtems/score/thread.h>
#include <rtems/score/threadqimpl.h>
+#include <rtems/score/status.h>
#include <rtems/score/watchdog.h>
#ifdef __cplusplus
@@ -36,27 +37,6 @@ extern "C" {
#define CORE_RWLOCK_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
/**
- * Core RWLock handler return statuses.
- */
-typedef enum {
- /** This status indicates that the operation completed successfully. */
- CORE_RWLOCK_SUCCESSFUL,
- /** This status indicates that the thread was blocked waiting for an */
- CORE_RWLOCK_WAS_DELETED,
- /** This status indicates that the rwlock was not immediately available. */
- CORE_RWLOCK_UNAVAILABLE,
- /** This status indicates that the calling task was willing to block
- * but the operation was unable to complete within the time allotted
- * because the resource never became available.
- */
- CORE_RWLOCK_TIMEOUT
-} CORE_RWLock_Status;
-
-/** This is the last status value.
- */
-#define CORE_RWLOCK_STATUS_LAST CORE_RWLOCK_TIMEOUT
-
-/**
* This is used to denote that a thread is blocking waiting for
* read-only access to the RWLock.
*/
@@ -117,11 +97,9 @@ RTEMS_INLINE_ROUTINE void _CORE_RWLock_Release(
* @param[in] wait is true if the calling thread is willing to wait
* @param[in] timeout is the number of ticks the calling thread is willing
* to wait if @a wait is true.
- *
- * @note Status is returned via the thread control block.
*/
-void _CORE_RWLock_Seize_for_reading(
+Status_Control _CORE_RWLock_Seize_for_reading(
CORE_RWLock_Control *the_rwlock,
Thread_Control *executing,
bool wait,
@@ -138,10 +116,8 @@ void _CORE_RWLock_Seize_for_reading(
* @param[in] wait is true if the calling thread is willing to wait
* @param[in] timeout is the number of ticks the calling thread is willing
* to wait if @a wait is true.
- *
- * @note Status is returned via the thread control block.
*/
-void _CORE_RWLock_Seize_for_writing(
+Status_Control _CORE_RWLock_Seize_for_writing(
CORE_RWLock_Control *the_rwlock,
Thread_Control *executing,
bool wait,
@@ -159,7 +135,7 @@ void _CORE_RWLock_Seize_for_writing(
*
* @retval Status is returned to indicate successful or failure.
*/
-CORE_RWLock_Status _CORE_RWLock_Surrender(
+Status_Control _CORE_RWLock_Surrender(
CORE_RWLock_Control *the_rwlock,
Thread_queue_Context *queue_context
);
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index 5dad11bc46..ac90f20b7d 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -22,8 +22,10 @@
#include <rtems/score/coresem.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/threaddispatch.h>
+#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/statesimpl.h>
+#include <rtems/score/status.h>
#ifdef __cplusplus
extern "C" {
@@ -35,39 +37,6 @@ extern "C" {
/**@{**/
/**
- * Core Semaphore handler return statuses.
- */
-typedef enum {
- /** This status indicates that the operation completed successfully. */
- CORE_SEMAPHORE_STATUS_SUCCESSFUL,
- /** This status indicates that the calling task did not want to block
- * and the operation was unable to complete immediately because the
- * resource was unavailable.
- */
- CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
- /** This status indicates that the thread was blocked waiting for an
- * operation to complete and the semaphore was deleted.
- */
- CORE_SEMAPHORE_WAS_DELETED,
- /** This status indicates that the calling task was willing to block
- * but the operation was unable to complete within the time allotted
- * because the resource never became available.
- */
- CORE_SEMAPHORE_TIMEOUT,
- /** This status indicates that an attempt was made to unlock the semaphore
- * and this would have made its count greater than that allowed.
- */
- CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
-} CORE_semaphore_Status;
-
-/**
- * @brief Core semaphore last status value.
- *
- * This is the last status value.
- */
-#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
-
-/**
* @brief Initialize the semaphore based on the parameters passed.
*
* This package is the implementation of the CORE Semaphore Handler.
@@ -108,18 +77,6 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release(
);
}
-Thread_Control *_CORE_semaphore_Was_deleted(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- Thread_queue_Context *queue_context
-);
-
-Thread_Control *_CORE_semaphore_Unsatisfied_nowait(
- Thread_Control *the_thread,
- Thread_queue_Queue *queue,
- Thread_queue_Context *queue_context
-);
-
RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
CORE_semaphore_Control *the_semaphore,
Thread_queue_Context *queue_context
@@ -128,7 +85,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
_Thread_queue_Flush_critical(
&the_semaphore->Wait_queue.Queue,
the_semaphore->operations,
- _CORE_semaphore_Was_deleted,
+ _Thread_queue_Flush_status_object_was_deleted,
queue_context
);
_Thread_queue_Destroy( &the_semaphore->Wait_queue );
@@ -147,16 +104,16 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
*
* @retval an indication of whether the routine succeeded or failed
*/
-RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Surrender(
CORE_semaphore_Control *the_semaphore,
uint32_t maximum_count,
Thread_queue_Context *queue_context
)
{
Thread_Control *the_thread;
- CORE_semaphore_Status status;
+ Status_Control status;
- status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
+ status = STATUS_SUCCESSFUL;
_CORE_semaphore_Acquire_critical( the_semaphore, queue_context );
@@ -175,7 +132,7 @@ RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
if ( the_semaphore->count < maximum_count )
the_semaphore->count += 1;
else
- status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
+ status = STATUS_MAXIMUM_COUNT_EXCEEDED;
_CORE_semaphore_Release( the_semaphore, queue_context );
}
@@ -191,7 +148,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush(
_Thread_queue_Flush_critical(
&the_semaphore->Wait_queue.Queue,
the_semaphore->operations,
- _CORE_semaphore_Unsatisfied_nowait,
+ _Thread_queue_Flush_status_unavailable,
queue_context
);
}
@@ -225,7 +182,7 @@ RTEMS_INLINE_ROUTINE uint32_t _CORE_semaphore_Get_count(
*
* @note There is currently no MACRO version of this routine.
*/
-RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(
+RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize(
CORE_semaphore_Control *the_semaphore,
Thread_Control *executing,
bool wait,
@@ -235,18 +192,16 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(
{
/* disabled when you get here */
- executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
_CORE_semaphore_Acquire_critical( the_semaphore, queue_context );
if ( the_semaphore->count != 0 ) {
the_semaphore->count -= 1;
_CORE_semaphore_Release( the_semaphore, queue_context );
- return;
+ return STATUS_SUCCESSFUL;
}
if ( !wait ) {
_CORE_semaphore_Release( the_semaphore, queue_context );
- executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
- return;
+ return STATUS_UNSATISFIED;
}
_Thread_queue_Enqueue_critical(
@@ -255,9 +210,9 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(
executing,
STATES_WAITING_FOR_SEMAPHORE,
timeout,
- CORE_SEMAPHORE_TIMEOUT,
&queue_context->Lock_context
);
+ return _Thread_Wait_get_status( executing );
}
/** @} */
diff --git a/cpukit/score/include/rtems/score/corespinlockimpl.h b/cpukit/score/include/rtems/score/corespinlockimpl.h
index fd4fcf29db..140529b573 100644
--- a/cpukit/score/include/rtems/score/corespinlockimpl.h
+++ b/cpukit/score/include/rtems/score/corespinlockimpl.h
@@ -20,6 +20,7 @@
#define _RTEMS_SCORE_CORESPINLOCKIMPL_H
#include <rtems/score/corespinlock.h>
+#include <rtems/score/status.h>
#include <rtems/score/watchdog.h>
#include <string.h>
@@ -33,37 +34,6 @@ extern "C" {
*/
/**@{**/
-/**
- * Core Spinlock handler return statuses.
- */
-typedef enum {
- /** This status indicates that the operation completed successfully. */
- CORE_SPINLOCK_SUCCESSFUL,
- /** This status indicates that the current thread already holds the spinlock.
- * An attempt to relock it will result in deadlock.
- */
- CORE_SPINLOCK_HOLDER_RELOCKING,
- /** This status indicates that the current thread is attempting to unlock a
- * spinlock that is held by another thread.
- */
- CORE_SPINLOCK_NOT_HOLDER,
- /** This status indicates that a thread reached the limit of time it
- * was willing to wait on the spin lock.
- */
- CORE_SPINLOCK_TIMEOUT,
- /** This status indicates that a thread is currently waiting for this
- * spin lock.
- */
- CORE_SPINLOCK_IS_BUSY,
- /** This status indicates that the spinlock is currently locked and thus
- * unavailable.
- */
- CORE_SPINLOCK_UNAVAILABLE
-} CORE_spinlock_Status;
-
-/** This is a shorthand for the last status code. */
-#define CORE_SPINLOCK_STATUS_LAST CORE_SPINLOCK_UNAVAILABLE
-
/** This indicates the lock is available. */
#define CORE_SPINLOCK_UNLOCKED 0
@@ -115,7 +85,7 @@ RTEMS_INLINE_ROUTINE void _CORE_spinlock_Release(
* @retval A status is returned which indicates the success or failure of
* this operation.
*/
-CORE_spinlock_Status _CORE_spinlock_Seize(
+Status_Control _CORE_spinlock_Seize(
CORE_spinlock_Control *the_spinlock,
bool wait,
Watchdog_Interval timeout,
@@ -130,7 +100,7 @@ CORE_spinlock_Status _CORE_spinlock_Seize(
*
* @param[in] the_spinlock is the spinlock to surrender
*/
-CORE_spinlock_Status _CORE_spinlock_Surrender(
+Status_Control _CORE_spinlock_Surrender(
CORE_spinlock_Control *the_spinlock,
ISR_lock_Context *lock_context
);
diff --git a/cpukit/score/include/rtems/score/mpciimpl.h b/cpukit/score/include/rtems/score/mpciimpl.h
index 8d19956fbc..eb03a1d7b3 100644
--- a/cpukit/score/include/rtems/score/mpciimpl.h
+++ b/cpukit/score/include/rtems/score/mpciimpl.h
@@ -19,6 +19,7 @@
#define _RTEMS_SCORE_MPCIIMPL_H
#include <rtems/score/mpci.h>
+#include <rtems/score/status.h>
#ifdef __cplusplus
extern "C" {
@@ -162,15 +163,13 @@ void _MPCI_Send_process_packet (
* set in addition to the remote operation pending state. It
* may indicate the caller is blocking on a message queue
* operation.
- * @param[in] timeout_code is the timeout code
*
* @retval This method returns the operation status from the remote node.
*/
-uint32_t _MPCI_Send_request_packet (
- uint32_t destination,
- MP_packet_Prefix *the_packet,
- States_Control extra_state,
- uint32_t timeout_code
+Status_Control _MPCI_Send_request_packet(
+ uint32_t destination,
+ MP_packet_Prefix *the_packet,
+ States_Control extra_state
);
/**
diff --git a/cpukit/score/include/rtems/score/mrsp.h b/cpukit/score/include/rtems/score/mrsp.h
index cb3de67e26..595884864f 100644
--- a/cpukit/score/include/rtems/score/mrsp.h
+++ b/cpukit/score/include/rtems/score/mrsp.h
@@ -51,31 +51,6 @@ extern "C" {
* @{
*/
-/**
- * @brief MrsP status code.
- *
- * The values are chosen to directly map to RTEMS status codes. In case this
- * implementation is used for other APIs, then for example the errno values can
- * be added with a bit shift.
- */
-typedef enum {
- MRSP_SUCCESSFUL = 0,
- MRSP_TIMEOUT = 6,
- MRSP_INVALID_NUMBER = 10,
- MRSP_RESOUCE_IN_USE = 12,
- MRSP_UNSATISFIED = 13,
- MRSP_INCORRECT_STATE = 14,
- MRSP_INVALID_PRIORITY = 19,
- MRSP_NOT_OWNER_OF_RESOURCE = 23,
- MRSP_NO_MEMORY = 26,
-
- /**
- * @brief Internal state used for MRSP_Rival::status to indicate that this
- * rival waits for resource ownership.
- */
- MRSP_WAIT_FOR_OWNERSHIP = 255
-} MRSP_Status;
-
typedef struct MRSP_Control MRSP_Control;
/**
@@ -124,10 +99,10 @@ typedef struct {
* @brief The rival status.
*
* Initially the status is set to MRSP_WAIT_FOR_OWNERSHIP. The rival will
- * busy wait until a status change happens. This can be MRSP_SUCCESSFUL or
- * MRSP_TIMEOUT. State changes are protected by the MrsP control lock.
+ * busy wait until a status change happens. This can be STATUS_SUCCESSFUL or
+ * STATUS_TIMEOUT. State changes are protected by the MrsP control lock.
*/
- volatile MRSP_Status status;
+ volatile int status;
/**
* @brief Watchdog for timeouts.
diff --git a/cpukit/score/include/rtems/score/mrspimpl.h b/cpukit/score/include/rtems/score/mrspimpl.h
index 5173343293..ffdc802f6f 100644
--- a/cpukit/score/include/rtems/score/mrspimpl.h
+++ b/cpukit/score/include/rtems/score/mrspimpl.h
@@ -23,6 +23,7 @@
#include <rtems/score/chainimpl.h>
#include <rtems/score/resourceimpl.h>
#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/status.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
@@ -36,6 +37,12 @@ extern "C" {
* @{
*/
+/**
+ * @brief Internal state used for MRSP_Rival::status to indicate that this
+ * rival waits for resource ownership.
+ */
+#define MRSP_WAIT_FOR_OWNERSHIP STATUS_MINUS_ONE
+
/*
* FIXME: Operations with the resource dependency tree are protected by the
* global scheduler lock. Since the scheduler lock should be scheduler
@@ -126,7 +133,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Claim_ownership(
_Thread_Dispatch_enable( cpu_self );
}
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Initialize(
+RTEMS_INLINE_ROUTINE Status_Control _MRSP_Initialize(
MRSP_Control *mrsp,
Priority_Control ceiling_priority,
Thread_Control *executing,
@@ -137,14 +144,14 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Initialize(
uint32_t i;
if ( initially_locked ) {
- return MRSP_INVALID_NUMBER;
+ return STATUS_INVALID_NUMBER;
}
mrsp->ceiling_priorities = _Workspace_Allocate(
sizeof( *mrsp->ceiling_priorities ) * scheduler_count
);
if ( mrsp->ceiling_priorities == NULL ) {
- return MRSP_NO_MEMORY;
+ return STATUS_NO_MEMORY;
}
for ( i = 0 ; i < scheduler_count ; ++i ) {
@@ -155,7 +162,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Initialize(
_Chain_Initialize_empty( &mrsp->Rivals );
_ISR_lock_Initialize( &mrsp->Lock, "MrsP" );
- return MRSP_SUCCESSFUL;
+ return STATUS_SUCCESSFUL;
}
RTEMS_INLINE_ROUTINE Priority_Control _MRSP_Get_ceiling_priority(
@@ -199,7 +206,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Timeout( Watchdog_Control *watchdog )
_MRSP_Giant_release( &giant_lock_context );
- rival->status = MRSP_TIMEOUT;
+ rival->status = STATUS_TIMEOUT;
_MRSP_Release( mrsp, &queue_context );
} else {
@@ -207,7 +214,7 @@ RTEMS_INLINE_ROUTINE void _MRSP_Timeout( Watchdog_Control *watchdog )
}
}
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
+RTEMS_INLINE_ROUTINE Status_Control _MRSP_Wait_for_ownership(
MRSP_Control *mrsp,
Resource_Node *owner,
Thread_Control *executing,
@@ -217,7 +224,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
Thread_queue_Context *queue_context
)
{
- MRSP_Status status;
+ Status_Control status;
MRSP_Rival rival;
Thread_Life_state life_state;
Per_CPU_Control *cpu_self;
@@ -278,7 +285,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
);
_ISR_Local_enable( level );
- if ( status == MRSP_TIMEOUT ) {
+ if ( status == STATUS_TIMEOUT ) {
_MRSP_Restore_priority( executing, initial_priority );
}
}
@@ -286,7 +293,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
return status;
}
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
+RTEMS_INLINE_ROUTINE Status_Control _MRSP_Seize(
MRSP_Control *mrsp,
Thread_Control *executing,
bool wait,
@@ -294,7 +301,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
Thread_queue_Context *queue_context
)
{
- MRSP_Status status;
+ Status_Control status;
const Scheduler_Control *scheduler = _Scheduler_Get_own( executing );
uint32_t scheduler_index = _Scheduler_Get_index( scheduler );
Priority_Control initial_priority = executing->current_priority;
@@ -308,7 +315,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
if ( !priority_ok) {
_ISR_lock_ISR_enable( &queue_context->Lock_context );
- return MRSP_INVALID_PRIORITY;
+ return STATUS_MUTEX_CEILING_VIOLATED;
}
_MRSP_Acquire_critical( mrsp, queue_context );
@@ -321,7 +328,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
ceiling_priority,
queue_context
);
- status = MRSP_SUCCESSFUL;
+ status = STATUS_SUCCESSFUL;
} else if (
wait
&& _Resource_Node_get_root( owner ) != &executing->Resource_node
@@ -338,13 +345,13 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
} else {
_MRSP_Release( mrsp, queue_context );
/* Not available, nested access or deadlock */
- status = MRSP_UNSATISFIED;
+ status = STATUS_UNAVAILABLE;
}
return status;
}
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
+RTEMS_INLINE_ROUTINE Status_Control _MRSP_Surrender(
MRSP_Control *mrsp,
Thread_Control *executing,
Thread_queue_Context *queue_context
@@ -356,7 +363,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
if ( _Resource_Get_owner( &mrsp->Resource ) != &executing->Resource_node ) {
_ISR_lock_ISR_enable( &queue_context->Lock_context );
- return MRSP_NOT_OWNER_OF_RESOURCE;
+ return STATUS_NOT_OWNER;
}
if (
@@ -366,7 +373,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
)
) {
_ISR_lock_ISR_enable( &queue_context->Lock_context );
- return MRSP_INCORRECT_STATE;
+ return STATUS_RELEASE_ORDER_VIOLATION;
}
initial_priority = mrsp->initial_priority_of_owner;
@@ -388,7 +395,7 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
* This must be inside the critical section since the status prevents a
* potential double extraction in _MRSP_Timeout().
*/
- rival->status = MRSP_SUCCESSFUL;
+ rival->status = STATUS_SUCCESSFUL;
new_owner = rival->thread;
mrsp->initial_priority_of_owner = rival->initial_priority;
@@ -413,16 +420,16 @@ RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
_Thread_Dispatch_enable( cpu_self );
- return MRSP_SUCCESSFUL;
+ return STATUS_SUCCESSFUL;
}
-RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Can_destroy( MRSP_Control *mrsp )
+RTEMS_INLINE_ROUTINE Status_Control _MRSP_Can_destroy( MRSP_Control *mrsp )
{
if ( _Resource_Get_owner( &mrsp->Resource ) != NULL ) {
- return MRSP_RESOUCE_IN_USE;
+ return STATUS_RESOURCE_IN_USE;
}
- return MRSP_SUCCESSFUL;
+ return STATUS_SUCCESSFUL;
}
RTEMS_INLINE_ROUTINE void _MRSP_Destroy(
diff --git a/cpukit/score/include/rtems/score/status.h b/cpukit/score/include/rtems/score/status.h
new file mode 100644
index 0000000000..eaf69c1597
--- /dev/null
+++ b/cpukit/score/include/rtems/score/status.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2016 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_STATUS_H
+#define _RTEMS_SCORE_STATUS_H
+
+#include <rtems/score/basedefs.h>
+
+#if defined(RTEMS_POSIX_API)
+#include <errno.h>
+#include <pthread.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Status code parts for the Classic API.
+ *
+ * Must be in synchronization with rtems_status_code.
+ */
+typedef enum {
+ STATUS_CLASSIC_INCORRECT_STATE = 14,
+ STATUS_CLASSIC_INTERNAL_ERROR = 13,
+ STATUS_CLASSIC_INVALID_NUMBER = 10,
+ STATUS_CLASSIC_INVALID_PRIORITY = 19,
+ STATUS_CLASSIC_INVALID_SIZE = 8,
+ STATUS_CLASSIC_NO_MEMORY = 26,
+ STATUS_CLASSIC_NOT_OWNER_OF_RESOURCE = 23,
+ STATUS_CLASSIC_OBJECT_WAS_DELETED = 7,
+ STATUS_CLASSIC_RESOURCE_IN_USE = 12,
+ STATUS_CLASSIC_SUCCESSFUL = 0,
+ STATUS_CLASSIC_TIMEOUT = 6,
+ STATUS_CLASSIC_TOO_MANY = 5,
+ STATUS_CLASSIC_UNSATISFIED = 13
+} Status_Classic;
+
+/**
+ * @brief Macro to build a status code from Classic and POSIX API parts.
+ */
+#if defined(RTEMS_POSIX_API)
+ #define STATUS_BUILD( classic_status, posix_status ) \
+ ( ( ( posix_status ) << 8 ) | ( classic_status ) )
+#else
+ #define STATUS_BUILD( classic_status, posix_status ) \
+ ( classic_status )
+#endif
+
+/**
+ * @brief Macro to get the Classic API status code.
+ */
+#define STATUS_GET_CLASSIC( status ) \
+ ( ( status ) & 0xff )
+
+/**
+ * @brief Macro to get the POSIX API status code.
+ *
+ * Performs an arithmetic shift to reconstruct a negative POSIX status.
+ */
+#define STATUS_GET_POSIX( status ) \
+ ( ( ( (int) ( status ) ) | 0xff ) >> 8 )
+
+/**
+ * @brief Status codes.
+ */
+typedef enum {
+ STATUS_BARRIER_AUTOMATICALLY_RELEASED =
+ STATUS_BUILD( STATUS_CLASSIC_SUCCESSFUL, PTHREAD_BARRIER_SERIAL_THREAD ),
+ STATUS_DEADLOCK =
+ STATUS_BUILD( STATUS_CLASSIC_INCORRECT_STATE, EDEADLK ),
+ STATUS_FLUSHED =
+ STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EAGAIN ),
+ STATUS_INTERRUPTED =
+ STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EINTR ),
+ STATUS_INVALID_NUMBER =
+ STATUS_BUILD( STATUS_CLASSIC_INVALID_NUMBER, EINVAL ),
+ STATUS_MAXIMUM_COUNT_EXCEEDED =
+ STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EOVERFLOW ),
+ STATUS_MESSAGE_INVALID_SIZE =
+ STATUS_BUILD( STATUS_CLASSIC_INVALID_SIZE, EMSGSIZE ),
+ STATUS_MESSAGE_QUEUE_WAIT_IN_ISR =
+ STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, ENOMEM ),
+ STATUS_MESSAGE_QUEUE_WAS_DELETED =
+ STATUS_BUILD( STATUS_CLASSIC_OBJECT_WAS_DELETED, EBADF ),
+ STATUS_MINUS_ONE =
+ -1,
+ STATUS_MUTEX_CEILING_VIOLATED =
+ STATUS_BUILD( STATUS_CLASSIC_INVALID_PRIORITY, EINVAL ),
+ STATUS_NESTING_NOT_ALLOWED =
+ STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EDEADLK ),
+ STATUS_NO_MEMORY =
+ STATUS_BUILD( STATUS_CLASSIC_NO_MEMORY, EINVAL ),
+ STATUS_NOT_OWNER =
+ STATUS_BUILD( STATUS_CLASSIC_NOT_OWNER_OF_RESOURCE, EPERM ),
+ STATUS_OBJECT_WAS_DELETED =
+ STATUS_BUILD( STATUS_CLASSIC_OBJECT_WAS_DELETED, EINVAL ),
+ STATUS_RELEASE_ORDER_VIOLATION =
+ STATUS_BUILD( STATUS_CLASSIC_INCORRECT_STATE, EPERM ),
+ STATUS_RESOURCE_IN_USE =
+ STATUS_BUILD( STATUS_CLASSIC_RESOURCE_IN_USE, EBUSY ),
+ STATUS_SUCCESSFUL =
+ STATUS_BUILD( STATUS_CLASSIC_SUCCESSFUL, 0 ),
+ STATUS_TIMEOUT =
+ STATUS_BUILD( STATUS_CLASSIC_TIMEOUT, ETIMEDOUT ),
+ STATUS_TOO_MANY =
+ STATUS_BUILD( STATUS_CLASSIC_TOO_MANY, EAGAIN ),
+ STATUS_UNAVAILABLE =
+ STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EBUSY ),
+ STATUS_UNSATISFIED =
+ STATUS_BUILD( STATUS_CLASSIC_UNSATISFIED, EAGAIN )
+} Status_Control;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_STATUS_H */
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index ee19c0430f..4618a409eb 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -288,11 +288,6 @@ typedef struct {
uint32_t return_code;
/**
- * @brief Code to set the timeout return code in _Thread_Timeout().
- */
- uint32_t timeout_code;
-
- /**
* @brief The current thread queue.
*
* In case this field is @c NULL, then the thread is not blocked on a thread
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index cef2786ae4..10811088c9 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -29,6 +29,7 @@
#include <rtems/score/objectimpl.h>
#include <rtems/score/resourceimpl.h>
#include <rtems/score/statesimpl.h>
+#include <rtems/score/status.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/todimpl.h>
@@ -1450,20 +1451,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default_operations(
}
/**
- * @brief Sets the thread wait timeout code.
- *
- * @param[in] the_thread The thread.
- * @param[in] timeout_code The new thread wait timeout code.
- */
-RTEMS_INLINE_ROUTINE void _Thread_Wait_set_timeout_code(
- Thread_Control *the_thread,
- uint32_t timeout_code
-)
-{
- the_thread->Wait.timeout_code = timeout_code;
-}
-
-/**
* @brief Returns the object identifier of the object containing the current
* thread wait queue.
*
@@ -1479,6 +1466,13 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_set_timeout_code(
*/
Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread );
+RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status(
+ const Thread_Control *the_thread
+)
+{
+ return (Status_Control) the_thread->Wait.return_code;
+}
+
/**
* @brief General purpose thread wait timeout.
*
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 752e13e76e..7489d5466b 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -341,7 +341,6 @@ Thread_Control *_Thread_queue_Do_dequeue(
* @param[in] state The new state of the thread.
* @param[in] timeout Interval to wait. Use WATCHDOG_NO_TIMEOUT to block
* potentially forever.
- * @param[in] timeout_code The return code in case a timeout occurs.
* @param[in] lock_context The lock context of the lock acquire.
*/
void _Thread_queue_Enqueue_critical(
@@ -350,7 +349,6 @@ void _Thread_queue_Enqueue_critical(
Thread_Control *the_thread,
States_Control state,
Watchdog_Interval timeout,
- uint32_t timeout_code,
ISR_lock_Context *lock_context
);
@@ -363,8 +361,7 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
const Thread_queue_Operations *operations,
Thread_Control *the_thread,
States_Control state,
- Watchdog_Interval timeout,
- uint32_t timeout_code
+ Watchdog_Interval timeout
)
{
ISR_lock_Context lock_context;
@@ -376,7 +373,6 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
the_thread,
state,
timeout,
- timeout_code,
&lock_context
);
}
@@ -628,6 +624,40 @@ Thread_Control *_Thread_queue_Flush_default_filter(
);
/**
+ * @brief Status unavailable thread queue flush filter function.
+ *
+ * Sets the thread wait return code of the thread to STATUS_UNAVAILABLE.
+ *
+ * @param the_thread The thread to extract.
+ * @param queue Unused.
+ * @param queue_context Unused.
+ *
+ * @retval the_thread Extract this thread.
+ */
+Thread_Control *_Thread_queue_Flush_status_unavailable(
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
+);
+
+/**
+ * @brief Status object was deleted thread queue flush filter function.
+ *
+ * Sets the thread wait return code of the thread to STATUS_OBJECT_WAS_DELETED
+ *
+ * @param the_thread The thread to extract.
+ * @param queue Unused.
+ * @param queue_context Unused.
+ *
+ * @retval the_thread Extract this thread.
+ */
+Thread_Control *_Thread_queue_Flush_status_object_was_deleted(
+ Thread_Control *the_thread,
+ Thread_queue_Queue *queue,
+ Thread_queue_Context *queue_context
+);
+
+/**
* @brief Unblocks all threads enqueued on the thread queue.
*
* This function iteratively extracts the first enqueued thread of the thread