source: rtems/cpukit/posix/src/prwlockwrlock.c @ 0e16fa45

5
Last change on this file since 0e16fa45 was c3105894, checked in by Sebastian Huber <sebastian.huber@…>, on 10/19/17 at 11:47:57

score: Move thread queue timeout handling

Update #3117.
Update #3182.

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file
3 *
4 * @brief Obtain a Write Lock on a RWlock Instance
5 * @ingroup POSIXAPI
6 */
7
8/*
9 *  POSIX RWLock Manager -- Obtain a Write Lock 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_wrlock(
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 );
35  POSIX_RWLOCK_VALIDATE_OBJECT( the_rwlock );
36
37  _Thread_queue_Context_initialize( &queue_context );
38  _Thread_queue_Context_set_enqueue_do_nothing_extra( &queue_context );
39  status = _CORE_RWLock_Seize_for_writing(
40    &the_rwlock->RWLock,
41    true,          /* do not timeout -- wait forever */
42    &queue_context
43  );
44  return _POSIX_Get_error( status );
45}
Note: See TracBrowser for help on using the repository browser.