Ignore:
Timestamp:
Apr 19, 2016, 4:28:03 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
adbedd1
Parents:
bbe654af
git-author:
Sebastian Huber <sebastian.huber@…> (04/19/16 04:28:03)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/21/16 05:29:39)
Message:

posix: Avoid Giant lock for mutexes

Delete _POSIX_Mutex_Get(). Use _POSIX_Mutex_Get_interrupt_disable()
instead.

Update #2555.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/mutexgetprioceiling.c

    rbbe654af r48b04fc3  
    1919#endif
    2020
    21 #include <errno.h>
    22 #include <pthread.h>
    23 
    24 #include <rtems/system.h>
    25 #include <rtems/score/coremuteximpl.h>
    26 #include <rtems/score/watchdog.h>
    2721#include <rtems/posix/muteximpl.h>
    2822#include <rtems/posix/priorityimpl.h>
     
    3731)
    3832{
    39   register POSIX_Mutex_Control *the_mutex;
    40   Objects_Locations             location;
     33  POSIX_Mutex_Control *the_mutex;
     34  ISR_lock_Context     lock_context;
    4135
    42   if ( !prioceiling )
     36  if ( prioceiling == NULL ) {
    4337    return EINVAL;
    44 
    45   the_mutex = _POSIX_Mutex_Get( mutex, &location );
    46   switch ( location ) {
    47 
    48     case OBJECTS_LOCAL:
    49       *prioceiling = _POSIX_Priority_From_core(
    50         the_mutex->Mutex.Attributes.priority_ceiling
    51       );
    52       _Objects_Put( &the_mutex->Object );
    53       return 0;
    54 
    55 #if defined(RTEMS_MULTIPROCESSING)
    56     case OBJECTS_REMOTE:
    57 #endif
    58     case OBJECTS_ERROR:
    59       break;
    6038  }
    6139
    62   return EINVAL;
     40  the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &lock_context );
     41
     42  if ( the_mutex == NULL ) {
     43    return EINVAL;
     44  }
     45
     46  _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
     47
     48  *prioceiling = _POSIX_Priority_From_core(
     49    the_mutex->Mutex.Attributes.priority_ceiling
     50  );
     51
     52  _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
     53
     54  return 0;
    6355}
Note: See TracChangeset for help on using the changeset viewer.