source: rtems/cpukit/posix/src/prwlockunlock.c @ 5cb175bb

4.115
Last change on this file since 5cb175bb was 5cb175bb, checked in by Joel Sherrill <joel.sherrill@…>, on 01/10/13 at 19:22:31

cpukit/posix: Doxygen group is POSIXAPI

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @brief Function Releases a lock held on RWLock object referenced by rwlock
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  POSIX RWLock Manager -- Release a lock held on a RWLock Instance
10 *
11 *  COPYRIGHT (c) 1989-2007.
12 *  On-Line Applications Research Corporation (OAR).
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.com/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <pthread.h>
24#include <errno.h>
25
26#include <rtems/system.h>
27#include <rtems/posix/rwlock.h>
28
29/*
30 *  pthread_rwlock_unlock
31 *
32 *  This directive attempts to release a lock on an RWLock.
33 *
34 *  Input parameters:
35 *    rwlock          - pointer to rwlock id
36 *
37 *  Output parameters:
38 *    0          - if successful
39 *    error code - if unsuccessful
40 */
41
42int pthread_rwlock_unlock(
43  pthread_rwlock_t  *rwlock
44)
45{
46  POSIX_RWLock_Control  *the_rwlock;
47  Objects_Locations      location;
48  CORE_RWLock_Status     status;
49
50  if ( !rwlock )
51    return EINVAL;
52
53  the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
54  switch ( location ) {
55
56    case OBJECTS_LOCAL:
57      status = _CORE_RWLock_Release( &the_rwlock->RWLock );
58      _Thread_Enable_dispatch();
59      return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
60
61#if defined(RTEMS_MULTIPROCESSING)
62    case OBJECTS_REMOTE:
63#endif
64    case OBJECTS_ERROR:
65      break;
66  }
67
68  return EINVAL;
69}
Note: See TracBrowser for help on using the repository browser.