source: rtems/cpukit/posix/src/sempost.c @ e43f4758

4.115
Last change on this file since e43f4758 was e43f4758, checked in by Alex Ivanov <alexivanov97@…>, on 12/15/12 at 12:25:05

posix: Doxygen Enhancement Task #1

http://www.google-melange.com/gci/task/view/google/gci2012/7987220

  • 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-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.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/score/object.h>
31#include <rtems/posix/semaphore.h>
32#include <rtems/posix/time.h>
33#include <rtems/seterr.h>
34
35int sem_post(
36  sem_t  *sem
37)
38{
39  register POSIX_Semaphore_Control *the_semaphore;
40  Objects_Locations                 location;
41
42  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
43  switch ( location ) {
44
45    case OBJECTS_LOCAL:
46      _CORE_semaphore_Surrender(
47        &the_semaphore->Semaphore,
48        the_semaphore->Object.id,
49#if defined(RTEMS_MULTIPROCESSING)
50        NULL         /* XXX need to define a routine to handle this case */
51#else
52        NULL
53#endif
54      );
55      _Thread_Enable_dispatch();
56      return 0;
57
58#if defined(RTEMS_MULTIPROCESSING)
59    case OBJECTS_REMOTE:
60#endif
61    case OBJECTS_ERROR:
62      break;
63  }
64
65  rtems_set_errno_and_return_minus_one( EINVAL );
66}
Note: See TracBrowser for help on using the repository browser.