source: rtems/cpukit/posix/src/semaphorewaitsupp.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: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Semaphore Wait Support
5 * @ingroup POSIXSemaphorePrivate
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2012.
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 <semaphore.h>
22
23#include <rtems/posix/semaphoreimpl.h>
24#include <rtems/posix/posixapi.h>
25
26THREAD_QUEUE_OBJECT_ASSERT( POSIX_Semaphore_Control, Semaphore.Wait_queue );
27
28int _POSIX_Semaphore_Wait_support(
29  sem_t             *sem,
30  bool               blocking,
31  Watchdog_Interval  timeout
32)
33{
34  POSIX_Semaphore_Control *the_semaphore;
35  Thread_queue_Context     queue_context;
36  Status_Control           status;
37
38  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
39
40  if ( the_semaphore == NULL ) {
41    rtems_set_errno_and_return_minus_one( EINVAL );
42  }
43
44  _Thread_queue_Context_set_relative_timeout( &queue_context, timeout );
45  status = _CORE_semaphore_Seize(
46    &the_semaphore->Semaphore,
47    POSIX_SEMAPHORE_TQ_OPERATIONS,
48    _Thread_Executing,
49    blocking,
50    &queue_context
51  );
52  return _POSIX_Zero_or_minus_one_plus_errno( status );
53}
Note: See TracBrowser for help on using the repository browser.