From 7e66865e17d7a82add541056de13717793da002a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 29 Apr 2016 11:05:36 +0200 Subject: score: Move message notification Move message notification to end of critical section and delegate the message queue release to the notification handler. It may do more complex notification actions out of the critical section. Update #2555. --- cpukit/posix/src/mqueuenotify.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'cpukit/posix/src/mqueuenotify.c') diff --git a/cpukit/posix/src/mqueuenotify.c b/cpukit/posix/src/mqueuenotify.c index 810097691f..d31a8e662d 100644 --- a/cpukit/posix/src/mqueuenotify.c +++ b/cpukit/posix/src/mqueuenotify.c @@ -39,16 +39,24 @@ */ static void _POSIX_Message_queue_Notify_handler( - void *user_data + CORE_message_queue_Control *the_message_queue, + ISR_lock_Context *lock_context ) { POSIX_Message_queue_Control *the_mq; + int signo; - the_mq = user_data; + the_mq = RTEMS_CONTAINER_OF( + the_message_queue, + POSIX_Message_queue_Control, + Message_queue + ); - kill( getpid(), the_mq->notification.sigev_signo ); + signo = the_mq->notification.sigev_signo; + _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL ); + _CORE_message_queue_Release( &the_mq->Message_queue, lock_context ); - _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL ); + kill( getpid(), signo ); } int mq_notify( @@ -72,18 +80,17 @@ int mq_notify( rtems_set_errno_and_return_minus_one( EBUSY ); } - _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL ); + _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL ); the_mq->notification = *notification; _CORE_message_queue_Set_notify( &the_mq->Message_queue, - _POSIX_Message_queue_Notify_handler, - the_mq + _POSIX_Message_queue_Notify_handler ); } else { - _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL, NULL ); + _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL ); } -- cgit v1.2.3