source: rtems/cpukit/posix/src/prwlockrdlock.c @ 631b3c8

5
Last change on this file since 631b3c8 was 631b3c8, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 09:40:18

score: Move thread queue MP callout to context

Drop the multiprocessing (MP) dependent callout parameter from the
thread queue extract, dequeue, flush and unblock methods. Merge this
parameter with the lock context into new structure Thread_queue_Context.
This helps to gets rid of the conditionally compiled method call
helpers.

  • Property mode set to 100644
File size: 1.0 KB
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
23int pthread_rwlock_rdlock(
24  pthread_rwlock_t  *rwlock
25)
26{
27  POSIX_RWLock_Control *the_rwlock;
28  Thread_queue_Context  queue_context;
29  Thread_Control       *executing;
30
31  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
32
33  if ( the_rwlock == NULL ) {
34    return EINVAL;
35  }
36
37  executing = _Thread_Executing;
38  _CORE_RWLock_Seize_for_reading(
39    &the_rwlock->RWLock,
40    executing,
41    true,                 /* we are willing to wait forever */
42    0,
43    &queue_context
44  );
45  return _POSIX_RWLock_Translate_core_RWLock_return_code(
46    (CORE_RWLock_Status) executing->Wait.return_code
47  );
48}
Note: See TracBrowser for help on using the repository browser.