1 | /* |
---|
2 | * COPYRIGHT (c) 1989-1999. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.OARcorp.com/rtems/license.html. |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #if HAVE_CONFIG_H |
---|
13 | #include "config.h" |
---|
14 | #endif |
---|
15 | |
---|
16 | #include <itron.h> |
---|
17 | |
---|
18 | #include <rtems/itron/semaphore.h> |
---|
19 | #include <rtems/itron/task.h> |
---|
20 | #include <rtems/score/tod.h> |
---|
21 | |
---|
22 | /* |
---|
23 | * del_sem - Delete Semaphore |
---|
24 | * |
---|
25 | * This function implements the ITRON 3.0 del_sem() service. |
---|
26 | */ |
---|
27 | |
---|
28 | ER del_sem( |
---|
29 | ID semid |
---|
30 | ) |
---|
31 | { |
---|
32 | ITRON_Semaphore_Control *the_semaphore; |
---|
33 | Objects_Locations location; |
---|
34 | |
---|
35 | the_semaphore = _ITRON_Semaphore_Get( semid, &location ); |
---|
36 | switch ( location ) { |
---|
37 | case OBJECTS_REMOTE: /* Multiprocessing not supported */ |
---|
38 | case OBJECTS_ERROR: |
---|
39 | return _ITRON_Semaphore_Clarify_get_id_error( semid ); |
---|
40 | |
---|
41 | case OBJECTS_LOCAL: |
---|
42 | _CORE_semaphore_Flush( |
---|
43 | &the_semaphore->semaphore, |
---|
44 | NULL, /* Multiprocessing not supported */ |
---|
45 | CORE_SEMAPHORE_WAS_DELETED |
---|
46 | ); |
---|
47 | |
---|
48 | _ITRON_Objects_Close( |
---|
49 | &_ITRON_Semaphore_Information, |
---|
50 | &the_semaphore->Object |
---|
51 | ); |
---|
52 | |
---|
53 | _ITRON_Semaphore_Free( the_semaphore ); |
---|
54 | |
---|
55 | /* |
---|
56 | * If multiprocessing were supported, this is where we would announce |
---|
57 | * the destruction of the semaphore to the rest of the system. |
---|
58 | */ |
---|
59 | |
---|
60 | #if defined(RTEMS_MULTIPROCESSING) |
---|
61 | #endif |
---|
62 | |
---|
63 | _Thread_Enable_dispatch(); |
---|
64 | return E_OK; |
---|
65 | |
---|
66 | } |
---|
67 | return E_OK; |
---|
68 | } |
---|