RTEMS
coremsgbroadcast.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2008.
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 #include <rtems/score/objectimpl.h>
23 
25  CORE_message_queue_Control *the_message_queue,
26  const void *buffer,
27  size_t size,
28  uint32_t *count,
29  Thread_queue_Context *queue_context
30 )
31 {
32  Thread_Control *the_thread;
33  uint32_t number_broadcasted;
34 
35  if ( size > the_message_queue->maximum_message_size ) {
37  return STATUS_MESSAGE_INVALID_SIZE;
38  }
39 
40  number_broadcasted = 0;
41 
42  _CORE_message_queue_Acquire_critical( the_message_queue, queue_context );
43 
44  while (
45  ( the_thread =
47  the_message_queue,
48  buffer,
49  size,
50  0,
51  queue_context
52  )
53  )
54  ) {
55  number_broadcasted += 1;
56 
57  _CORE_message_queue_Acquire( the_message_queue, queue_context );
58  }
59 
60  _CORE_message_queue_Release( the_message_queue, queue_context );
61 
62  *count = number_broadcasted;
63  return STATUS_SUCCESSFUL;
64 }
Thread queue context for the thread queue methods.
Definition: threadq.h:198
Inlined Routines in the Core Message Handler.
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:416
Inlined Routines in the Object Handler.
static __inline__ Thread_Control * _CORE_message_queue_Dequeue_receiver(CORE_message_queue_Control *the_message_queue, const void *buffer, size_t size, CORE_message_queue_Submit_types submit_type, Thread_queue_Context *queue_context)
Gets the first locked thread waiting to receive and dequeues it.
Definition: coremsgimpl.h:612
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:203
Status_Control _CORE_message_queue_Broadcast(CORE_message_queue_Control *the_message_queue, const void *buffer, size_t size, uint32_t *count, Thread_queue_Context *queue_context)
Broadcasts a message to the message queue.
Control block used to manage each message queue.
Definition: coremsg.h:96
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
static __inline__ void _CORE_message_queue_Release(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Releases the message queue.
Definition: coremsgimpl.h:446
static __inline__ void _CORE_message_queue_Acquire_critical(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Acquires the message queue critical.
Definition: coremsgimpl.h:432
static __inline__ void _CORE_message_queue_Acquire(CORE_message_queue_Control *the_message_queue, Thread_queue_Context *queue_context)
Acquires the message queue.
Definition: coremsgimpl.h:418