source: rtems/cpukit/posix/src/mutexgetprioceiling.c @ 48b04fc3

5
Last change on this file since 48b04fc3 was 48b04fc3, checked in by Sebastian Huber <sebastian.huber@…>, on Apr 19, 2016 at 4:28:03 AM

posix: Avoid Giant lock for mutexes

Delete _POSIX_Mutex_Get(). Use _POSIX_Mutex_Get_interrupt_disable()
instead.

Update #2555.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Returns the Current Priority Ceiling of the Mutex
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/posix/muteximpl.h>
22#include <rtems/posix/priorityimpl.h>
23
24/*
25 *  13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
26 */
27
28int pthread_mutex_getprioceiling(
29  pthread_mutex_t   *mutex,
30  int               *prioceiling
31)
32{
33  POSIX_Mutex_Control *the_mutex;
34  ISR_lock_Context     lock_context;
35
36  if ( prioceiling == NULL ) {
37    return EINVAL;
38  }
39
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;
55}
Note: See TracBrowser for help on using the repository browser.