source: rtems/cpukit/posix/src/mutexlocksupp.c @ e633f3b

4.115
Last change on this file since e633f3b was e633f3b, checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/14 at 17:03:24

posix/*.c: Remove use of register keyword

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Support Call to function Enables Locking of Mutex Object
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
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>
27#include <rtems/posix/muteximpl.h>
28#include <rtems/posix/priorityimpl.h>
29#include <rtems/posix/time.h>
30
31/*
32 *  _POSIX_Mutex_Lock_support
33 *
34 *  A support routine which implements guts of the blocking, non-blocking, and
35 *  timed wait version of mutex lock.
36 */
37
38int _POSIX_Mutex_Lock_support(
39  pthread_mutex_t           *mutex,
40  bool                       blocking,
41  Watchdog_Interval          timeout
42)
43{
44  POSIX_Mutex_Control          *the_mutex;
45  Objects_Locations             location;
46  ISR_Level                     level;
47  Thread_Control               *executing;
48
49  the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &location, &level );
50  switch ( location ) {
51
52    case OBJECTS_LOCAL:
53      executing = _Thread_Executing;
54      _CORE_mutex_Seize(
55        &the_mutex->Mutex,
56        executing,
57        the_mutex->Object.id,
58        blocking,
59        timeout,
60        level
61      );
62      _Objects_Put_for_get_isr_disable( &the_mutex->Object );
63      return _POSIX_Mutex_Translate_core_mutex_return_code(
64        (CORE_mutex_Status) executing->Wait.return_code
65      );
66
67#if defined(RTEMS_MULTIPROCESSING)
68    case OBJECTS_REMOTE:
69#endif
70    case OBJECTS_ERROR:
71      break;
72  }
73
74  return EINVAL;
75}
Note: See TracBrowser for help on using the repository browser.