source:
rtems/cpukit/posix/src/sempost.c
@
651e3aa
Last change on this file since 651e3aa was 651e3aa, checked in by Joel Sherrill <joel.sherrill@…>, on 12/09/13 at 16:17:00 | |
---|---|
|
|
File size: 1.3 KB |
Rev | Line | |
---|---|---|
[e43f4758] | 1 | /** |
2 | * @file | |
3 | * | |
4 | * @brief Unlock a Semaphore | |
5 | * @ingroup POSIX_SEMAPHORE | |
6 | */ | |
7 | ||
[799c767] | 8 | /* |
[651e3aa] | 9 | * COPYRIGHT (c) 1989-2013. |
[feaa007] | 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. | |
[799c767] | 15 | */ |
16 | ||
[f42b726] | 17 | #if HAVE_CONFIG_H |
18 | #include "config.h" | |
19 | #endif | |
20 | ||
[799c767] | 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> | |
[9c743e8e] | 30 | #include <rtems/posix/semaphoreimpl.h> |
[799c767] | 31 | #include <rtems/posix/time.h> |
[188c82b] | 32 | #include <rtems/seterr.h> |
[799c767] | 33 | |
34 | int sem_post( | |
35 | sem_t *sem | |
36 | ) | |
37 | { | |
38 | register POSIX_Semaphore_Control *the_semaphore; | |
39 | Objects_Locations location; | |
[874297f3] | 40 | |
[799c767] | 41 | the_semaphore = _POSIX_Semaphore_Get( sem, &location ); |
42 | switch ( location ) { | |
[860c34e] | 43 | |
[799c767] | 44 | case OBJECTS_LOCAL: |
45 | _CORE_semaphore_Surrender( | |
46 | &the_semaphore->Semaphore, | |
47 | the_semaphore->Object.id, | |
48 | #if defined(RTEMS_MULTIPROCESSING) | |
[651e3aa] | 49 | NULL /* POSIX Semaphores are local only */ |
[799c767] | 50 | #else |
51 | NULL | |
52 | #endif | |
53 | ); | |
[2d2352b] | 54 | _Objects_Put( &the_semaphore->Object ); |
[799c767] | 55 | return 0; |
[860c34e] | 56 | |
57 | #if defined(RTEMS_MULTIPROCESSING) | |
58 | case OBJECTS_REMOTE: | |
59 | #endif | |
60 | case OBJECTS_ERROR: | |
61 | break; | |
[799c767] | 62 | } |
[860c34e] | 63 | |
64 | rtems_set_errno_and_return_minus_one( EINVAL ); | |
[799c767] | 65 | } |
Note: See TracBrowser
for help on using the repository browser.