source: rtems/cpukit/score/src/coremsgclose.c @ fce900b5

5
Last change on this file since fce900b5 was dce48791, checked in by Sebastian Huber <sebastian.huber@…>, on 05/23/16 at 11:37:59

score: Add Status_Control for all APIs

Unify the status codes of the Classic and POSIX API to use the new enum
Status_Control. This eliminates the Thread_Control::Wait::timeout_code
field and the timeout parameter of _Thread_queue_Enqueue_critical() and
_MPCI_Send_request_packet(). It gets rid of the status code translation
tables and instead uses simple bit operations to get the status for a
particular API. This enables translation of status code constants at
compile time. Add _Thread_Wait_get_status() to avoid direct access of
thread internal data structures.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Close a Message Queue
5 *  @ingroup ScoreMessageQueue
6 */
7
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/coremsgimpl.h>
22#include <rtems/score/wkspace.h>
23
24static Thread_Control *_CORE_message_queue_Was_deleted(
25  Thread_Control       *the_thread,
26  Thread_queue_Queue   *queue,
27  Thread_queue_Context *queue_context
28)
29{
30  the_thread->Wait.return_code = STATUS_MESSAGE_QUEUE_WAS_DELETED;
31
32  return the_thread;
33}
34
35void _CORE_message_queue_Close(
36  CORE_message_queue_Control *the_message_queue,
37  Thread_queue_Context       *queue_context
38)
39{
40
41  /*
42   *  This will flush blocked threads whether they were blocked on
43   *  a send or receive.
44   */
45
46  _Thread_queue_Flush_critical(
47    &the_message_queue->Wait_queue.Queue,
48    the_message_queue->operations,
49    _CORE_message_queue_Was_deleted,
50    queue_context
51  );
52
53  (void) _Workspace_Free( the_message_queue->message_buffers );
54
55  _Thread_queue_Destroy( &the_message_queue->Wait_queue );
56}
Note: See TracBrowser for help on using the repository browser.