RTEMS
coremsgclose.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-1999.
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.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
22 
23 static Thread_Control *_CORE_message_queue_Was_deleted(
24  Thread_Control *the_thread,
25  Thread_queue_Queue *queue,
26  Thread_queue_Context *queue_context
27 )
28 {
29  the_thread->Wait.return_code = STATUS_MESSAGE_QUEUE_WAS_DELETED;
30 
31  return the_thread;
32 }
33 
35  CORE_message_queue_Control *the_message_queue,
36  Thread_queue_Context *queue_context
37 )
38 {
39 
40  /*
41  * This will flush blocked threads whether they were blocked on
42  * a send or receive.
43  */
44 
46  &the_message_queue->Wait_queue.Queue,
47  the_message_queue->operations,
48  _CORE_message_queue_Was_deleted,
49  queue_context
50  );
51 
52  if ( the_message_queue->free_message_buffers != NULL ) {
53  ( *the_message_queue->free_message_buffers )(
54  the_message_queue->message_buffers
55  );
56  }
57 
58  _Thread_queue_Destroy( &the_message_queue->Wait_queue );
59 }
Thread_Wait_information Wait
Definition: thread.h:767
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Inlined Routines in the Core Message Handler.
void _CORE_message_queue_Close(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Closes a message queue.
Definition: coremsgclose.c:34
uint32_t return_code
Definition: thread.h:413
const Thread_queue_Operations * operations
The thread queue operations according to the blocking discipline.
Definition: coremsg.h:105
void(* free_message_buffers)(void *)
This member contains the optional message buffer storage area free handler.
Definition: coremsg.h:135
Thread_queue_Queue Queue
The actual thread queue.
Definition: threadq.h:583
size_t _Thread_queue_Flush_critical(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_queue_Flush_filter filter, Thread_queue_Context *queue_context)
Unblocks all threads enqueued on the thread queue.
Definition: threadqflush.c:63
Control block used to manage each message queue.
Definition: coremsg.h:96
static __inline__ void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
Definition: threadqimpl.h:1378
Thread_queue_Control Wait_queue
Definition: coremsg.h:100
CORE_message_queue_Buffer * message_buffers
Definition: coremsg.h:126