source: rtems/cpukit/posix/src/mutexunlock.c @ 0061ef98

4.104.114.84.9
Last change on this file since 0061ef98 was 0061ef98, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 26, 2007 at 10:56:12 PM

2007-03-26 Joel Sherrill <joel@…>

PR 1231/cpukit

  • posix/src/adasupp.c, posix/src/clockgetcpuclockid.c, posix/src/clockgetenableattr.c, posix/src/clockgetres.c, posix/src/clockgettime.c, posix/src/clocksetenableattr.c, posix/src/mutex.c, posix/src/mutexattrdestroy.c, posix/src/mutexattrgetprioceiling.c, posix/src/mutexattrgetprotocol.c, posix/src/mutexattrgetpshared.c, posix/src/mutexattrinit.c, posix/src/mutexattrsetprioceiling.c, posix/src/mutexattrsetprotocol.c, posix/src/mutexattrsetpshared.c, posix/src/mutexdefaultattributes.c, posix/src/mutexdestroy.c, posix/src/mutexgetprioceiling.c, posix/src/mutexlock.c, posix/src/mutexlocksupp.c, posix/src/mutexmp.c, posix/src/mutexsetprioceiling.c, posix/src/mutextimedlock.c, posix/src/mutextrylock.c, posix/src/mutexunlock.c, posix/src/nanosleep.c, posix/src/posixintervaltotimespec.c, posix/src/posixtimespecsubtract.c, posix/src/posixtimespectointerval.c, posix/src/psignalclearprocesssignals.c, posix/src/psignalclearsignals.c, posix/src/psignalsetprocesssignals.c, posix/src/psignalunblockthread.c, posix/src/ptimer.c, posix/src/ptimer1.c, posix/src/sched.c, posix/src/time.c: Remove unneeded includes of assert.h
  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  $Id$
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <errno.h>
10#include <pthread.h>
11
12#include <rtems/system.h>
13#include <rtems/score/coremutex.h>
14#include <rtems/score/watchdog.h>
15#if defined(RTEMS_MULTIPROCESSING)
16#include <rtems/score/mpci.h>
17#endif
18#include <rtems/posix/mutex.h>
19#include <rtems/posix/priority.h>
20#include <rtems/posix/time.h>
21
22/*PAGE
23 *
24 *  11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
25 *
26 *  NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
27 */
28
29int pthread_mutex_unlock(
30  pthread_mutex_t           *mutex
31)
32{
33  register POSIX_Mutex_Control *the_mutex;
34  Objects_Locations             location;
35  CORE_mutex_Status             status;
36
37  the_mutex = _POSIX_Mutex_Get( mutex, &location );
38  switch ( location ) {
39    case OBJECTS_REMOTE:
40#if defined(RTEMS_MULTIPROCESSING)
41      return _POSIX_Mutex_MP_Send_request_packet(
42          POSIX_MUTEX_MP_RELEASE_REQUEST,
43          *mutex,
44          0,                    /* Not used */
45          MPCI_DEFAULT_TIMEOUT
46      );
47#endif
48    case OBJECTS_ERROR:
49      return EINVAL;
50    case OBJECTS_LOCAL:
51      status = _CORE_mutex_Surrender(
52        &the_mutex->Mutex,
53        the_mutex->Object.id,
54#if defined(RTEMS_MULTIPROCESSING)
55        _POSIX_Threads_mutex_MP_support
56#else
57        NULL
58#endif
59      );
60      _Thread_Enable_dispatch();
61      return _POSIX_Mutex_From_core_mutex_status( status );
62      break;
63  }
64  return POSIX_BOTTOM_REACHED();
65}
Note: See TracBrowser for help on using the repository browser.