source: rtems/cpukit/posix/src/mutexunlock.c @ 188c82b

4.104.114.84.95
Last change on this file since 188c82b was 64f55e7, checked in by Joel Sherrill <joel.sherrill@…>, on 11/29/99 at 15:40:38

Made sure POSIX would build with MP enabled.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  $Id$
3 */
4
5#include <assert.h>
6#include <errno.h>
7#include <pthread.h>
8
9#include <rtems/system.h>
10#include <rtems/score/coremutex.h>
11#include <rtems/score/watchdog.h>
12#if defined(RTEMS_MULTIPROCESSING)
13#include <rtems/score/mpci.h>
14#endif
15#include <rtems/posix/mutex.h>
16#include <rtems/posix/priority.h>
17#include <rtems/posix/time.h>
18
19/*PAGE
20 *
21 *  11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
22 *       
23 *  NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
24 */
25
26int pthread_mutex_unlock(
27  pthread_mutex_t           *mutex
28)
29{
30  register POSIX_Mutex_Control *the_mutex;
31  Objects_Locations             location;
32  CORE_mutex_Status             status;
33 
34  the_mutex = _POSIX_Mutex_Get( mutex, &location );
35  switch ( location ) {
36    case OBJECTS_REMOTE:
37#if defined(RTEMS_MULTIPROCESSING)
38      return _POSIX_Mutex_MP_Send_request_packet(
39          POSIX_MUTEX_MP_RELEASE_REQUEST,
40          *mutex,
41          0,                    /* Not used */
42          MPCI_DEFAULT_TIMEOUT
43      );
44#endif
45    case OBJECTS_ERROR:
46      return EINVAL;
47    case OBJECTS_LOCAL:
48      status = _CORE_mutex_Surrender(
49        &the_mutex->Mutex,
50        the_mutex->Object.id,
51#if defined(RTEMS_MULTIPROCESSING)
52        _POSIX_Threads_mutex_MP_support
53#else
54        NULL
55#endif
56      );
57      _Thread_Enable_dispatch();
58      return _POSIX_Mutex_From_core_mutex_status( status );
59      break;
60  }
61  return POSIX_BOTTOM_REACHED();
62}
Note: See TracBrowser for help on using the repository browser.