source: rtems/cpukit/posix/src/prwlockunlock.c @ dbb30e26

5
Last change on this file since dbb30e26 was 89fc9345, checked in by Sebastian Huber <sebastian.huber@…>, on 09/21/17 at 13:42:45

posix: Implement self-contained POSIX rwlocks

POSIX rwlocks are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3115.

  • Property mode set to 100644
File size: 1.2 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.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <rtems/posix/rwlockimpl.h>
24#include <rtems/posix/posixapi.h>
25
26#include <string.h>
27
28bool _POSIX_RWLock_Auto_initialization( POSIX_RWLock_Control *the_rwlock )
29{
30  POSIX_RWLock_Control zero;
31
32  memset( &zero, 0, sizeof( zero ) );
33
34  if ( memcmp( the_rwlock, &zero, sizeof( *the_rwlock ) ) != 0 ) {
35    return false;
36  }
37
38  the_rwlock->flags = POSIX_RWLOCK_MAGIC;
39  return true;
40}
41
42int pthread_rwlock_unlock(
43  pthread_rwlock_t  *rwlock
44)
45{
46  POSIX_RWLock_Control *the_rwlock;
47  Status_Control        status;
48
49  the_rwlock = _POSIX_RWLock_Get( rwlock );
50  POSIX_RWLOCK_VALIDATE_OBJECT( the_rwlock );
51
52  status = _CORE_RWLock_Surrender( &the_rwlock->RWLock );
53  return _POSIX_Get_error( status );
54}
Note: See TracBrowser for help on using the repository browser.