diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-15 21:18:26 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-21 07:29:39 +0200 |
commit | adbedd10cfe5259018b1682d903ab40f6005b3f0 (patch) | |
tree | dde02dde8c5760625667a949661f0bfab266e0dc /cpukit/score/src/coremsgclose.c | |
parent | posix: Avoid Giant lock for mutexes (diff) | |
download | rtems-adbedd10cfe5259018b1682d903ab40f6005b3f0.tar.bz2 |
score: Introduce _Thread_queue_Flush_critical()
Replace _Thread_queue_Flush() with _Thread_queue_Flush_critical() and
add a filter function for customization of the thread queue flush
operation.
Update #2555.
Diffstat (limited to 'cpukit/score/src/coremsgclose.c')
-rw-r--r-- | cpukit/score/src/coremsgclose.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/cpukit/score/src/coremsgclose.c b/cpukit/score/src/coremsgclose.c index 1511f83b0a..7184b11bfa 100644 --- a/cpukit/score/src/coremsgclose.c +++ b/cpukit/score/src/coremsgclose.c @@ -21,6 +21,17 @@ #include <rtems/score/coremsgimpl.h> #include <rtems/score/wkspace.h> +static Thread_Control *_CORE_message_queue_Was_deleted( + Thread_Control *the_thread, + Thread_queue_Queue *queue, + ISR_lock_Context *lock_context +) +{ + the_thread->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED; + + return the_thread; +} + void _CORE_message_queue_Do_close( CORE_message_queue_Control *the_message_queue #if defined(RTEMS_MULTIPROCESSING) @@ -30,17 +41,21 @@ void _CORE_message_queue_Do_close( #endif ) { + ISR_lock_Context lock_context; + /* * This will flush blocked threads whether they were blocked on * a send or receive. */ - _Thread_queue_Flush( - &the_message_queue->Wait_queue, + _CORE_message_queue_Acquire( the_message_queue, &lock_context ); + _Thread_queue_Flush_critical( + &the_message_queue->Wait_queue.Queue, the_message_queue->operations, - CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED, + _CORE_message_queue_Was_deleted, mp_callout, - mp_id + mp_id, + &lock_context ); (void) _Workspace_Free( the_message_queue->message_buffers ); |