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

5
Last change on this file since dce48791 was dce48791, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 11:37:59

score: Add Status_Control for all APIs

Unify the status codes of the Classic and POSIX API to use the new enum
Status_Control. This eliminates the Thread_Control::Wait::timeout_code
field and the timeout parameter of _Thread_queue_Enqueue_critical() and
_MPCI_Send_request_packet(). It gets rid of the status code translation
tables and instead uses simple bit operations to get the status for a
particular API. This enables translation of status code constants at
compile time. Add _Thread_Wait_get_status() to avoid direct access of
thread internal data structures.

  • Property mode set to 100644
File size: 957 bytes
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
26int pthread_rwlock_unlock(
27  pthread_rwlock_t  *rwlock
28)
29{
30  POSIX_RWLock_Control *the_rwlock;
31  Thread_queue_Context  queue_context;
32  Status_Control        status;
33
34  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
35
36  if ( the_rwlock == NULL ) {
37    return EINVAL;
38  }
39
40  status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, &queue_context );
41  return _POSIX_Get_error( status );
42}
Note: See TracBrowser for help on using the repository browser.