From 4438ac2575fb9e0760bf53931a52d00dec4deb83 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Sat, 2 May 2015 14:27:24 +0200 Subject: score: Fine grained locking for mutexes Update #2273. --- cpukit/libnetworking/rtems/rtems_glue.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'cpukit/libnetworking/rtems/rtems_glue.c') diff --git a/cpukit/libnetworking/rtems/rtems_glue.c b/cpukit/libnetworking/rtems/rtems_glue.c index 63d4b8045f..e43dc6e1dc 100644 --- a/cpukit/libnetworking/rtems/rtems_glue.c +++ b/cpukit/libnetworking/rtems/rtems_glue.c @@ -378,9 +378,6 @@ rtems_bsdnet_semaphore_obtain (void) #ifdef RTEMS_FAST_MUTEX ISR_lock_Context lock_context; Thread_Control *executing; -#ifdef RTEMS_SMP - _Thread_Disable_dispatch(); -#endif _ISR_lock_ISR_disable(&lock_context); if (!the_networkSemaphore) rtems_panic ("rtems-net: network sema obtain: network not initialised\n"); @@ -393,9 +390,6 @@ rtems_bsdnet_semaphore_obtain (void) 0, /* forever */ &lock_context ); -#ifdef RTEMS_SMP - _Thread_Enable_dispatch(); -#endif if (executing->Wait.return_code) rtems_panic ("rtems-net: can't obtain network sema: %d\n", executing->Wait.return_code); @@ -416,18 +410,19 @@ void rtems_bsdnet_semaphore_release (void) { #ifdef RTEMS_FAST_MUTEX - int i; + ISR_lock_Context lock_context; + CORE_mutex_Status status; - _Thread_Disable_dispatch(); if (!the_networkSemaphore) rtems_panic ("rtems-net: network sema obtain: network not initialised\n"); - i = _CORE_mutex_Surrender ( + _ISR_lock_ISR_disable(&lock_context); + status = _CORE_mutex_Surrender ( &the_networkSemaphore->Core_control.mutex, networkSemaphore, - NULL + NULL, + &lock_context ); - _Thread_Enable_dispatch(); - if (i) + if (status != CORE_MUTEX_STATUS_SUCCESSFUL) rtems_panic ("rtems-net: can't release network sema: %i\n"); #else rtems_status_code sc; -- cgit v1.2.3