summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-30 11:39:58 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 09:08:20 +0200
commit9809d6e08264525ea58839b98e6d90121b841196 (patch)
tree7ccbdd61436c18d1e1bae9033a3907afb5bff629 /cpukit/score
parentscore: Fix _Thread_queue_Extract_locked() (diff)
downloadrtems-9809d6e08264525ea58839b98e6d90121b841196.tar.bz2
score: _Thread_queue_Flush() parameter changes
Change _Thread_queue_Flush() into a macro that invokes _Thread_queue_Do_flush() with the parameter set defined by RTEMS_MULTIPROCESSING. For multiprocessing configurations add the object identifier to avoid direct use of the thread wait information. Use mp_ prefix for multiprocessing related parameters. Rename Thread_queue_Flush_callout to Thread_queue_MP_callout since this type will be re-used later for other operations as well.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/include/rtems/score/corebarrierimpl.h24
-rw-r--r--cpukit/score/include/rtems/score/coremsgimpl.h45
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h31
-rw-r--r--cpukit/score/include/rtems/score/corerwlockimpl.h16
-rw-r--r--cpukit/score/include/rtems/score/coresemimpl.h42
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h81
-rw-r--r--cpukit/score/src/coremsgclose.c13
-rw-r--r--cpukit/score/src/coremutexflush.c38
-rw-r--r--cpukit/score/src/threadqflush.c12
10 files changed, 154 insertions, 150 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 5d5f6880af..eb5bfa39cd 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -175,7 +175,7 @@ libscore_a_SOURCES += src/coremsg.c src/coremsgbroadcast.c \
src/coremsgsubmit.c
## CORE_MUTEX_C_FILES
-libscore_a_SOURCES += src/coremutex.c src/coremutexflush.c \
+libscore_a_SOURCES += src/coremutex.c \
src/coremutexseize.c src/coremutexsurrender.c \
src/coremutexseizeintr.c
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 87ea545747..7e1c0ab31a 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -140,21 +140,19 @@ uint32_t _CORE_barrier_Release(
CORE_barrier_API_mp_support_callout api_barrier_mp_support
);
-/**
- * This routine assists in the deletion of a barrier by flushing the
- * associated wait queue.
- *
- * @param[in] _the_barrier is the barrier to flush
- * @param[in] _remote_extract_callout is the routine to invoke if the
- * thread unblocked is remote
- * @param[in] _status is the status to be returned to the unblocked thread
- */
-#define _CORE_barrier_Flush( _the_barrier, _remote_extract_callout, _status) \
+/* Must be a macro due to the multiprocessing dependent parameters */
+#define _CORE_barrier_Flush( \
+ the_barrier, \
+ status, \
+ mp_callout, \
+ mp_id \
+) \
_Thread_queue_Flush( \
- &((_the_barrier)->Wait_queue), \
+ &( the_barrier )->Wait_queue, \
CORE_BARRIER_TQ_OPERATIONS, \
- (_remote_extract_callout), \
- (_status) \
+ status, \
+ mp_callout, \
+ mp_id \
)
/**
diff --git a/cpukit/score/include/rtems/score/coremsgimpl.h b/cpukit/score/include/rtems/score/coremsgimpl.h
index 407d3aee15..5b7abb2594 100644
--- a/cpukit/score/include/rtems/score/coremsgimpl.h
+++ b/cpukit/score/include/rtems/score/coremsgimpl.h
@@ -139,6 +139,16 @@ bool _CORE_message_queue_Initialize(
size_t maximum_message_size
);
+void _CORE_message_queue_Do_close(
+ CORE_message_queue_Control *the_message_queue,
+ uint32_t status
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
+);
+
/**
* @brief Close a message queue.
*
@@ -150,16 +160,37 @@ bool _CORE_message_queue_Initialize(
* flushing @a the_message_queue's task wait queue.
*
* @param[in] the_message_queue points to the message queue to close
- * @param[in] remote_extract_callout is the routine to call for each thread
- * that is extracted from the set of waiting threads
* @param[in] status is the status that each waiting thread will return
* from it's blocking service
+ * @param[in] mp_callout is the routine to call for each thread
+ * that is extracted from the set of waiting threads
+ * @param[in] mp_id the object identifier of the message queue object
*/
-void _CORE_message_queue_Close(
- CORE_message_queue_Control *the_message_queue,
- Thread_queue_Flush_callout remote_extract_callout,
- uint32_t status
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_message_queue_Close( \
+ the_message_queue, \
+ status, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_message_queue_Do_close( \
+ the_message_queue, \
+ status, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _CORE_message_queue_Close( \
+ the_message_queue, \
+ status, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_message_queue_Do_close( \
+ the_message_queue, \
+ status \
+ )
+#endif
/**
* @brief Flush pending messages.
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index a1cbb17734..812b6ba9cb 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -324,23 +324,20 @@ CORE_mutex_Status _CORE_mutex_Surrender(
ISR_lock_Context *lock_context
);
-/**
- * @brief Flush all waiting threads.
- *
- * This routine assists in the deletion of a mutex by flushing the associated
- * wait queue.
- *
- * @param[in] the_mutex is the mutex to flush
- * @param[in] remote_extract_callout is the routine to invoke when a remote
- * thread is extracted
- * @param[in] status is the status value which each unblocked thread will
- * return to its caller.
- */
-void _CORE_mutex_Flush(
- CORE_mutex_Control *the_mutex,
- Thread_queue_Flush_callout remote_extract_callout,
- uint32_t status
-);
+/* Must be a macro due to the multiprocessing dependent parameters */
+#define _CORE_mutex_Flush( \
+ the_mutex, \
+ status, \
+ mp_callout, \
+ mp_id \
+) \
+ _Thread_queue_Flush( \
+ &( the_mutex )->Wait_queue, \
+ ( the_mutex )->operations, \
+ status, \
+ mp_callout, \
+ mp_id \
+ )
/**
* @brief Is mutex locked.
diff --git a/cpukit/score/include/rtems/score/corerwlockimpl.h b/cpukit/score/include/rtems/score/corerwlockimpl.h
index 6d563a56cc..b9803c43c5 100644
--- a/cpukit/score/include/rtems/score/corerwlockimpl.h
+++ b/cpukit/score/include/rtems/score/corerwlockimpl.h
@@ -143,22 +143,6 @@ CORE_RWLock_Status _CORE_RWLock_Release(
);
/**
- * This routine assists in the deletion of a RWLock by flushing the
- * associated wait queue.
- *
- * @param[in] _the_rwlock is the RWLock to flush
- * @param[in] _remote_extract_callout is the routine to invoke if the
- * thread unblocked is remote
- * @param[in] _status is the status to be returned to the unblocked thread
- */
-#define _CORE_RWLock_Flush( _the_rwlock, _remote_extract_callout, _status) \
- _Thread_queue_Flush( \
- &((_the_rwlock)->Wait_queue), \
- (_remote_extract_callout), \
- (_status) \
- )
-
-/**
* This method is used to initialize core rwlock attributes.
*
* @param[in] the_attributes pointer to the attributes to initialize.
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index 46033a8499..bde3e5b493 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -167,34 +167,20 @@ RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
return status;
}
-/**
- * @brief Core semaphore flush.
- *
- * This package is the implementation of the CORE Semaphore Handler.
- * This core object utilizes standard Dijkstra counting semaphores to provide
- * synchronization and mutual exclusion capabilities.
- *
- * This routine assists in the deletion of a semaphore by flushing the
- * associated wait queue.
- *
- * @param[in] the_semaphore is the semaphore to flush
- * @param[in] remote_extract_callout is the routine to invoke if the
- * thread unblocked is remote
- * @param[in] status is the status to be returned to the unblocked thread
- */
-RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush(
- CORE_semaphore_Control *the_semaphore,
- Thread_queue_Flush_callout remote_extract_callout,
- uint32_t status
-)
-{
- _Thread_queue_Flush(
- &the_semaphore->Wait_queue,
- the_semaphore->operations,
- remote_extract_callout,
- status
- );
-}
+/* Must be a macro due to the multiprocessing dependent parameters */
+#define _CORE_semaphore_Flush( \
+ the_semaphore, \
+ status, \
+ mp_callout, \
+ mp_id \
+) \
+ _Thread_queue_Flush( \
+ &( the_semaphore )->Wait_queue, \
+ ( the_semaphore )->operations, \
+ status, \
+ mp_callout, \
+ mp_id \
+ )
/**
* This routine returns the current count associated with the semaphore.
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 82f7dc1796..76f29d37f6 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -153,13 +153,20 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Release(
);
}
+#if defined(RTEMS_MULTIPROCESSING)
/**
- * The following type defines the callout used when a remote task
- * is extracted from a local thread queue.
+ * @brief Multiprocessing (MP) support callout for thread queue operations.
+ *
+ * @param the_proxy The thread proxy of the thread queue operation. A thread
+ * control is actually a thread proxy if and only if
+ * _Objects_Is_local_id( the_proxy->Object.id ) is false.
+ * @param mp_id Object identifier of the object containing the thread queue.
*/
-typedef void ( *Thread_queue_Flush_callout )(
- Thread_Control *
- );
+typedef void ( *Thread_queue_MP_callout )(
+ Thread_Control *the_proxy,
+ Objects_Id mp_id
+);
+#endif
/**
* @brief Gets a pointer to a thread waiting on the_thread_queue.
@@ -439,26 +446,60 @@ Thread_Control *_Thread_queue_First(
const Thread_queue_Operations *operations
);
-/**
- * @brief Unblocks all threads blocked on the_thread_queue.
- *
- * This routine unblocks all threads blocked on the_thread_queue
- * and cancels any associated timeouts.
- *
- * @param[in] the_thread_queue is the pointer to a threadq header
- * @param[in] operations The thread queue operations.
- * @param[in] remote_extract_callout points to a method to invoke to
- * invoke when a remote thread is unblocked
- * @param[in] status is the status which will be returned to
- * all unblocked threads
- */
-void _Thread_queue_Flush(
+void _Thread_queue_Do_flush(
Thread_queue_Control *the_thread_queue,
const Thread_queue_Operations *operations,
- Thread_queue_Flush_callout remote_extract_callout,
uint32_t status
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
);
+/**
+ * @brief Unblocks all threads blocked on the thread queue.
+ *
+ * The thread timers of the threads are cancelled.
+ *
+ * @param the_thread_queue The thread queue.
+ * @param operations The thread queue operations.
+ * @param status The return status for the threads.
+ * @param mp_callout Callout to extract the proxy of a remote thread. This
+ * parameter is only used on multiprocessing configurations.
+ * @param mp_id Object identifier of the object containing the thread queue.
+ * This parameter is only used on multiprocessing configurations.
+ */
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _Thread_queue_Flush( \
+ the_thread_queue, \
+ operations, \
+ status, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_flush( \
+ the_thread_queue, \
+ operations, \
+ status, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _Thread_queue_Flush( \
+ the_thread_queue, \
+ operations, \
+ status, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_flush( \
+ the_thread_queue, \
+ operations, \
+ status \
+ )
+#endif
+
void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue );
#if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c
index 60b6c9225b..fd026adfc9 100644
--- a/cpukit/score/src/coremsgclose.c
+++ b/cpukit/score/src/coremsgclose.c
@@ -21,10 +21,14 @@
#include <rtems/score/coremsgimpl.h>
#include <rtems/score/wkspace.h>
-void _CORE_message_queue_Close(
+void _CORE_message_queue_Do_close(
CORE_message_queue_Control *the_message_queue,
- Thread_queue_Flush_callout remote_extract_callout,
uint32_t status
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
)
{
ISR_lock_Context lock_context;
@@ -37,8 +41,9 @@ void _CORE_message_queue_Close(
_Thread_queue_Flush(
&the_message_queue->Wait_queue,
the_message_queue->operations,
- remote_extract_callout,
- status
+ status,
+ mp_callout,
+ mp_id
);
/*
diff --git a/cpukit/score/src/coremutexflush.c b/cpukit/score/src/coremutexflush.c
deleted file mode 100644
index c487652daa..0000000000
--- a/cpukit/score/src/coremutexflush.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * @file
- *
- * @brief Flush all waiting threads
- * @ingroup ScoreMutex
- */
-
-/*
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/score/isr.h>
-#include <rtems/score/coremuteximpl.h>
-#include <rtems/score/thread.h>
-
-void _CORE_mutex_Flush(
- CORE_mutex_Control *the_mutex,
- Thread_queue_Flush_callout remote_extract_callout,
- uint32_t status
-)
-{
- _Thread_queue_Flush(
- &the_mutex->Wait_queue,
- the_mutex->operations,
- remote_extract_callout,
- status
- );
-}
diff --git a/cpukit/score/src/threadqflush.c b/cpukit/score/src/threadqflush.c
index 13d2a5b1ac..694c7466d1 100644
--- a/cpukit/score/src/threadqflush.c
+++ b/cpukit/score/src/threadqflush.c
@@ -21,15 +21,15 @@
#include <rtems/score/threadqimpl.h>
#include <rtems/score/objectimpl.h>
-void _Thread_queue_Flush(
+void _Thread_queue_Do_flush(
Thread_queue_Control *the_thread_queue,
const Thread_queue_Operations *operations,
+ uint32_t status
#if defined(RTEMS_MULTIPROCESSING)
- Thread_queue_Flush_callout remote_extract_callout,
-#else
- Thread_queue_Flush_callout remote_extract_callout RTEMS_UNUSED,
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
#endif
- uint32_t status
)
{
ISR_lock_Context lock_context;
@@ -59,7 +59,7 @@ void _Thread_queue_Flush(
#if defined(RTEMS_MULTIPROCESSING)
if ( !_Objects_Is_local_id( the_thread->Object.id ) )
- ( *remote_extract_callout )( the_thread );
+ ( *mp_callout )( the_thread, mp_id );
#endif
_Thread_queue_Acquire( the_thread_queue, &lock_context );