source: rtems/cpukit/posix/src/sempost.c @ 583ef3a5

4.115
Last change on this file since 583ef3a5 was 651e3aa, checked in by Joel Sherrill <joel.sherrill@…>, on 12/09/13 at 16:17:00

cpukit/rtems: Remove XXX in comments

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Unlock a Semaphore
5 *  @ingroup POSIX_SEMAPHORE
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2013.
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.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <stdarg.h>
22
23#include <errno.h>
24#include <fcntl.h>
25#include <pthread.h>
26#include <semaphore.h>
27#include <limits.h>
28
29#include <rtems/system.h>
30#include <rtems/posix/semaphoreimpl.h>
31#include <rtems/posix/time.h>
32#include <rtems/seterr.h>
33
34int sem_post(
35  sem_t  *sem
36)
37{
38  register POSIX_Semaphore_Control *the_semaphore;
39  Objects_Locations                 location;
40
41  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
42  switch ( location ) {
43
44    case OBJECTS_LOCAL:
45      _CORE_semaphore_Surrender(
46        &the_semaphore->Semaphore,
47        the_semaphore->Object.id,
48#if defined(RTEMS_MULTIPROCESSING)
49        NULL         /* POSIX Semaphores are local only */
50#else
51        NULL
52#endif
53      );
54      _Objects_Put( &the_semaphore->Object );
55      return 0;
56
57#if defined(RTEMS_MULTIPROCESSING)
58    case OBJECTS_REMOTE:
59#endif
60    case OBJECTS_ERROR:
61      break;
62  }
63
64  rtems_set_errno_and_return_minus_one( EINVAL );
65}
Note: See TracBrowser for help on using the repository browser.