source: rtems/cpukit/posix/src/prwlockrdlock.c @ 127c20eb

5
Last change on this file since 127c20eb was f23d470, checked in by Gedare Bloom <gedare@…>, on 06/09/16 at 15:33:15

cpukit: Add and use Watchdog_Discipline.

Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE,
or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with
a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline
of WATCHDOG_NO_TIMEOUT.

updates #2732

  • Property mode set to 100644
File size: 1018 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Obtain a Read Lock on a RWLock Instance
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/posix/rwlockimpl.h>
22#include <rtems/posix/posixapi.h>
23
24int pthread_rwlock_rdlock(
25  pthread_rwlock_t  *rwlock
26)
27{
28  POSIX_RWLock_Control *the_rwlock;
29  Thread_queue_Context  queue_context;
30  Status_Control        status;
31
32  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
33
34  if ( the_rwlock == NULL ) {
35    return EINVAL;
36  }
37
38  _Thread_queue_Context_set_no_timeout( &queue_context );
39  status = _CORE_RWLock_Seize_for_reading(
40    &the_rwlock->RWLock,
41    _Thread_Executing,
42    true,                 /* we are willing to wait forever */
43    &queue_context
44  );
45  return _POSIX_Get_error( status );
46}
Note: See TracBrowser for help on using the repository browser.