[PATCH 3/5] score: _Thread_queue_Flush() parameter changes

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Apr 1 13:56:13 UTC 2016


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.
---
 cpukit/posix/src/mqueuedeletesupp.c                |  3 +-
 cpukit/posix/src/mutexdestroy.c                    |  2 +-
 cpukit/posix/src/semaphoredeletesupp.c             | 10 +--
 cpukit/rtems/include/rtems/rtems/msgmp.h           |  3 +-
 cpukit/rtems/include/rtems/rtems/semmp.h           |  3 +-
 cpukit/rtems/src/barrierdelete.c                   |  3 +-
 cpukit/rtems/src/msgmp.c                           |  5 +-
 cpukit/rtems/src/msgqdelete.c                      |  9 +--
 cpukit/rtems/src/semdelete.c                       | 16 ++---
 cpukit/rtems/src/semflush.c                        | 16 ++---
 cpukit/rtems/src/semmp.c                           |  5 +-
 cpukit/score/Makefile.am                           |  2 +-
 cpukit/score/include/rtems/score/corebarrierimpl.h | 24 +++----
 cpukit/score/include/rtems/score/coremsgimpl.h     | 45 ++++++++++--
 cpukit/score/include/rtems/score/coremuteximpl.h   | 31 ++++-----
 cpukit/score/include/rtems/score/corerwlockimpl.h  | 16 -----
 cpukit/score/include/rtems/score/coresemimpl.h     | 42 ++++-------
 cpukit/score/include/rtems/score/threadqimpl.h     | 81 ++++++++++++++++------
 cpukit/score/src/coremsgclose.c                    | 13 ++--
 cpukit/score/src/coremutexflush.c                  | 38 ----------
 cpukit/score/src/threadqflush.c                    | 12 ++--
 21 files changed, 186 insertions(+), 193 deletions(-)
 delete mode 100644 cpukit/score/src/coremutexflush.c

diff --git a/cpukit/posix/src/mqueuedeletesupp.c b/cpukit/posix/src/mqueuedeletesupp.c
index 9bf17a3..30b8b7d 100644
--- a/cpukit/posix/src/mqueuedeletesupp.c
+++ b/cpukit/posix/src/mqueuedeletesupp.c
@@ -59,8 +59,9 @@ void _POSIX_Message_queue_Delete(
 
       _CORE_message_queue_Close(
         &the_mq->Message_queue,
+        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
         NULL,        /* no MP support */
-        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
+        0
       );
 
     _POSIX_Message_queue_Free( the_mq );
diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c
index 9ff3dba..fb5aee6 100644
--- a/cpukit/posix/src/mutexdestroy.c
+++ b/cpukit/posix/src/mutexdestroy.c
@@ -55,7 +55,7 @@ int pthread_mutex_destroy(
       }
 
       _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
-      _CORE_mutex_Flush( &the_mutex->Mutex, NULL, EINVAL );
+      _CORE_mutex_Flush( &the_mutex->Mutex, EINVAL, NULL, 0 );
       _Objects_Put( &the_mutex->Object );
       _POSIX_Mutex_Free( the_mutex );
       _Objects_Allocator_unlock();
diff --git a/cpukit/posix/src/semaphoredeletesupp.c b/cpukit/posix/src/semaphoredeletesupp.c
index d9cf1d3..650cdcd 100644
--- a/cpukit/posix/src/semaphoredeletesupp.c
+++ b/cpukit/posix/src/semaphoredeletesupp.c
@@ -35,14 +35,8 @@ void _POSIX_Semaphore_Delete(
 )
 {
   if ( !the_semaphore->linked && !the_semaphore->open_count ) {
-      _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
-
-      _CORE_semaphore_Flush(
-        &the_semaphore->Semaphore,
-        NULL,
-        -1
-      );
-
+    _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
+    _CORE_semaphore_Flush( &the_semaphore->Semaphore, -1, NULL, 0 );
     _POSIX_Semaphore_Free( the_semaphore );
   }
 }
diff --git a/cpukit/rtems/include/rtems/rtems/msgmp.h b/cpukit/rtems/include/rtems/rtems/msgmp.h
index f3c31f2..436e287 100644
--- a/cpukit/rtems/include/rtems/rtems/msgmp.h
+++ b/cpukit/rtems/include/rtems/rtems/msgmp.h
@@ -152,7 +152,8 @@ void _Message_queue_MP_Process_packet (
  *  the remote node must be informed of this.
  */
 void _Message_queue_MP_Send_object_was_deleted (
-  Thread_Control *the_proxy
+  Thread_Control *the_proxy,
+  Objects_Id      mp_id
 );
 
 /**
diff --git a/cpukit/rtems/include/rtems/rtems/semmp.h b/cpukit/rtems/include/rtems/rtems/semmp.h
index 9c9a1e6..74f9400 100644
--- a/cpukit/rtems/include/rtems/rtems/semmp.h
+++ b/cpukit/rtems/include/rtems/rtems/semmp.h
@@ -121,7 +121,8 @@ void _Semaphore_MP_Process_packet (
  *  the remote node must be informed of this.
  */
 void _Semaphore_MP_Send_object_was_deleted (
-  Thread_Control *the_proxy
+  Thread_Control *the_proxy,
+  Objects_Id      mp_id
 );
 
 /**
diff --git a/cpukit/rtems/src/barrierdelete.c b/cpukit/rtems/src/barrierdelete.c
index 2ea1550..9ddfe01 100644
--- a/cpukit/rtems/src/barrierdelete.c
+++ b/cpukit/rtems/src/barrierdelete.c
@@ -35,8 +35,9 @@ rtems_status_code rtems_barrier_delete(
     case OBJECTS_LOCAL:
       _CORE_barrier_Flush(
         &the_barrier->Barrier,
+        CORE_BARRIER_WAS_DELETED,
         NULL,
-        CORE_BARRIER_WAS_DELETED
+        id
       );
 
       _Objects_Close( &_Barrier_Information, &the_barrier->Object );
diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c
index 53077c4..3f27068 100644
--- a/cpukit/rtems/src/msgmp.c
+++ b/cpukit/rtems/src/msgmp.c
@@ -435,14 +435,15 @@ void _Message_queue_MP_Process_packet (
  */
 
 void _Message_queue_MP_Send_object_was_deleted (
-  Thread_Control  *the_proxy
+  Thread_Control *the_proxy,
+  Objects_Id      mp_id
 )
 {
   the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
 
   _Message_queue_MP_Send_response_packet(
     MESSAGE_QUEUE_MP_RECEIVE_RESPONSE,
-    the_proxy->Wait.id,
+    mp_id,
     the_proxy
   );
 }
diff --git a/cpukit/rtems/src/msgqdelete.c b/cpukit/rtems/src/msgqdelete.c
index e2df2b9..d6e773d 100644
--- a/cpukit/rtems/src/msgqdelete.c
+++ b/cpukit/rtems/src/msgqdelete.c
@@ -47,12 +47,9 @@ rtems_status_code rtems_message_queue_delete(
 
       _CORE_message_queue_Close(
         &the_message_queue->message_queue,
-        #if defined(RTEMS_MULTIPROCESSING)
-          _Message_queue_MP_Send_object_was_deleted,
-        #else
-          NULL,
-        #endif
-        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED
+        CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED,
+        _Message_queue_MP_Send_object_was_deleted,
+        id
       );
 
 #if defined(RTEMS_MULTIPROCESSING)
diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c
index e9c3ad2..6a83d25 100644
--- a/cpukit/rtems/src/semdelete.c
+++ b/cpukit/rtems/src/semdelete.c
@@ -31,12 +31,6 @@
 
 #include <rtems/score/interr.h>
 
-#if defined(RTEMS_MULTIPROCESSING)
-#define SEMAPHORE_MP_OBJECT_WAS_DELETED _Semaphore_MP_Send_object_was_deleted
-#else
-#define SEMAPHORE_MP_OBJECT_WAS_DELETED NULL
-#endif
-
 rtems_status_code rtems_semaphore_delete(
   rtems_id   id
 )
@@ -73,15 +67,17 @@ rtems_status_code rtems_semaphore_delete(
         }
         _CORE_mutex_Flush(
           &the_semaphore->Core_control.mutex,
-          SEMAPHORE_MP_OBJECT_WAS_DELETED,
-          CORE_MUTEX_WAS_DELETED
+          CORE_MUTEX_WAS_DELETED,
+          _Semaphore_MP_Send_object_was_deleted,
+          id
         );
         _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
       } else {
         _CORE_semaphore_Flush(
           &the_semaphore->Core_control.semaphore,
-          SEMAPHORE_MP_OBJECT_WAS_DELETED,
-          CORE_SEMAPHORE_WAS_DELETED
+          CORE_SEMAPHORE_WAS_DELETED,
+          _Semaphore_MP_Send_object_was_deleted,
+          id
         );
         _CORE_semaphore_Destroy( &the_semaphore->Core_control.semaphore );
       }
diff --git a/cpukit/rtems/src/semflush.c b/cpukit/rtems/src/semflush.c
index b9b1ec6..ea06883 100644
--- a/cpukit/rtems/src/semflush.c
+++ b/cpukit/rtems/src/semflush.c
@@ -31,12 +31,6 @@
 
 #include <rtems/score/interr.h>
 
-#if defined(RTEMS_MULTIPROCESSING)
-#define SEND_OBJECT_WAS_DELETED _Semaphore_MP_Send_object_was_deleted
-#else
-#define SEND_OBJECT_WAS_DELETED NULL
-#endif
-
 rtems_status_code rtems_semaphore_flush(
   rtems_id        id
 )
@@ -59,14 +53,16 @@ rtems_status_code rtems_semaphore_flush(
       if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
         _CORE_mutex_Flush(
           &the_semaphore->Core_control.mutex,
-          SEND_OBJECT_WAS_DELETED,
-          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT
+          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
+          _Semaphore_MP_Send_object_was_deleted,
+          id
         );
       } else {
         _CORE_semaphore_Flush(
           &the_semaphore->Core_control.semaphore,
-          SEND_OBJECT_WAS_DELETED,
-          CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT
+          CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
+          _Semaphore_MP_Send_object_was_deleted,
+          id
         );
       }
       _Objects_Put( &the_semaphore->Object );
diff --git a/cpukit/rtems/src/semmp.c b/cpukit/rtems/src/semmp.c
index 90432c1..752831e 100644
--- a/cpukit/rtems/src/semmp.c
+++ b/cpukit/rtems/src/semmp.c
@@ -233,14 +233,15 @@ void _Semaphore_MP_Process_packet (
 }
 
 void _Semaphore_MP_Send_object_was_deleted (
-  Thread_Control *the_proxy
+  Thread_Control *the_proxy,
+  Objects_Id      mp_id
 )
 {
   the_proxy->receive_packet->return_code = RTEMS_OBJECT_WAS_DELETED;
 
   _Semaphore_MP_Send_response_packet(
     SEMAPHORE_MP_OBTAIN_RESPONSE,
-    the_proxy->Wait.id,
+    mp_id,
     the_proxy
   );
 
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 6ff4e02..162a04e 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 87ea545..7e1c0ab 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 407d3ae..5b7abb2 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 b22f4a7..68187c9 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -325,23 +325,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 6d563a5..b9803c4 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 c70e54f..96619e6 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 82f7dc1..76f29d3 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 60b6c92..fd026ad 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 c487652..0000000
--- 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 13d2a5b..694c746 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 );
-- 
1.8.4.5




More information about the devel mailing list