1 | /* |
---|
2 | * ITRON 3.0 Mailbox Manager |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <rtems/itron.h> |
---|
19 | |
---|
20 | #include <rtems/itron/mbox.h> |
---|
21 | #include <rtems/itron/task.h> |
---|
22 | |
---|
23 | /* |
---|
24 | * del_mbx - Delete Mailbox |
---|
25 | * |
---|
26 | * |
---|
27 | * ------Parameters-------------- |
---|
28 | * ID mbxid The Mailbox's ID |
---|
29 | * ------------------------------ |
---|
30 | * |
---|
31 | * -----Return Parameters------- |
---|
32 | * ER ercd Itron Error Code |
---|
33 | * ----------------------------- |
---|
34 | * |
---|
35 | * -----C Language Interface---- |
---|
36 | * ER ercd = del_mbx(ID mbxid); |
---|
37 | * ----------------------------- |
---|
38 | * |
---|
39 | */ |
---|
40 | |
---|
41 | ER del_mbx( |
---|
42 | ID mbxid |
---|
43 | ) |
---|
44 | { |
---|
45 | register ITRON_Mailbox_Control *the_mailbox; |
---|
46 | Objects_Locations location; |
---|
47 | |
---|
48 | the_mailbox= _ITRON_Mailbox_Get( mbxid, &location ); |
---|
49 | switch ( location ) { |
---|
50 | case OBJECTS_ERROR: |
---|
51 | case OBJECTS_REMOTE: |
---|
52 | return _ITRON_Mailbox_Clarify_get_id_error( mbxid ); |
---|
53 | |
---|
54 | case OBJECTS_LOCAL: |
---|
55 | _Objects_Close( &_ITRON_Mailbox_Information, &the_mailbox->Object ); |
---|
56 | |
---|
57 | _CORE_message_queue_Close( |
---|
58 | &the_mailbox->message_queue, |
---|
59 | NULL, /* Multiprocessing not supported */ |
---|
60 | CORE_MESSAGE_QUEUE_STATUS_WAS_DELETED |
---|
61 | ); |
---|
62 | |
---|
63 | _ITRON_Mailbox_Free(the_mailbox); |
---|
64 | break; |
---|
65 | } |
---|
66 | |
---|
67 | _ITRON_return_errorno( E_OK ); |
---|
68 | } |
---|