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

4.104.114.95
Last change on this file since f8437c8 was f8437c8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 15:23:12

Convert to "bool".

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <errno.h>
17#include <pthread.h>
18
19#include <rtems/system.h>
20#include <rtems/score/coremutex.h>
21#include <rtems/score/watchdog.h>
22#if defined(RTEMS_MULTIPROCESSING)
23#include <rtems/score/mpci.h>
24#endif
25#include <rtems/posix/mutex.h>
26#include <rtems/posix/priority.h>
27#include <rtems/posix/time.h>
28
29/*PAGE
30 *
31 *  _POSIX_Mutex_Lock_support
32 *
33 *  A support routine which implements guts of the blocking, non-blocking, and
34 *  timed wait version of mutex lock.
35 */
36
37int _POSIX_Mutex_Lock_support(
38  pthread_mutex_t           *mutex,
39  bool                       blocking,
40  Watchdog_Interval          timeout
41)
42{
43  register POSIX_Mutex_Control *the_mutex;
44  Objects_Locations             location;
45  ISR_Level                     level;
46
47  the_mutex = _POSIX_Mutex_Get_interrupt_disable( mutex, &location, &level );
48  switch ( location ) {
49
50    case OBJECTS_LOCAL:
51      _CORE_mutex_Seize(
52        &the_mutex->Mutex,
53        the_mutex->Object.id,
54        blocking,
55        timeout,
56        level
57      );
58      return _POSIX_Mutex_Translate_core_mutex_return_code(
59        (CORE_mutex_Status) _Thread_Executing->Wait.return_code
60      );
61
62#if defined(RTEMS_MULTIPROCESSING)
63    case OBJECTS_REMOTE:
64#endif
65    case OBJECTS_ERROR:
66      break;
67  }
68
69  return EINVAL;
70}
Note: See TracBrowser for help on using the repository browser.