4.104.114.84.95
Last change
on this file since 64f55e7 was
101e9b0,
checked in by Jennifer Averett <Jennifer.Averett@…>, on 11/22/99 at 16:14:00
|
Fixed dispatching and cleaned up code.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* |
---|
2 | * $Id$ |
---|
3 | */ |
---|
4 | |
---|
5 | #include <stdarg.h> |
---|
6 | |
---|
7 | #include <errno.h> |
---|
8 | #include <fcntl.h> |
---|
9 | #include <pthread.h> |
---|
10 | #include <semaphore.h> |
---|
11 | #include <limits.h> |
---|
12 | |
---|
13 | #include <rtems/system.h> |
---|
14 | #include <rtems/score/object.h> |
---|
15 | #include <rtems/posix/semaphore.h> |
---|
16 | #include <rtems/posix/time.h> |
---|
17 | #include <rtems/posix/seterr.h> |
---|
18 | |
---|
19 | /*PAGE |
---|
20 | * |
---|
21 | * 11.2.2 Destroy an Unnamed Semaphore, P1003.1b-1993, p.220 |
---|
22 | */ |
---|
23 | |
---|
24 | int sem_destroy( |
---|
25 | sem_t *sem |
---|
26 | ) |
---|
27 | { |
---|
28 | register POSIX_Semaphore_Control *the_semaphore; |
---|
29 | Objects_Locations location; |
---|
30 | |
---|
31 | the_semaphore = _POSIX_Semaphore_Get( sem, &location ); |
---|
32 | switch ( location ) { |
---|
33 | case OBJECTS_ERROR: |
---|
34 | set_errno_and_return_minus_one( EINVAL ); |
---|
35 | case OBJECTS_REMOTE: |
---|
36 | _Thread_Dispatch(); |
---|
37 | return POSIX_MP_NOT_IMPLEMENTED(); |
---|
38 | set_errno_and_return_minus_one( EINVAL ); |
---|
39 | case OBJECTS_LOCAL: |
---|
40 | /* |
---|
41 | * Undefined operation on a named semaphore. |
---|
42 | */ |
---|
43 | |
---|
44 | if ( the_semaphore->named == TRUE ) { |
---|
45 | _Thread_Enable_dispatch(); |
---|
46 | set_errno_and_return_minus_one( EINVAL ); |
---|
47 | } |
---|
48 | |
---|
49 | _POSIX_Semaphore_Delete( the_semaphore ); |
---|
50 | _Thread_Enable_dispatch(); |
---|
51 | return 0; |
---|
52 | } |
---|
53 | return POSIX_BOTTOM_REACHED(); |
---|
54 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.