![]()  | 
  
    ROOT-Sim core
    3.0.0-rc.2
    
   A General-Purpose Multi-threaded Parallel/Distributed Simulation Library 
   | 
 
Message queue datatype. More...
#include <datatypes/msg_queue.h>#include <core/sync.h>#include <datatypes/heap.h>#include <lp/lp.h>#include <mm/msg_allocator.h>#include <stdalign.h>#include <stdatomic.h>
Classes | |
| struct | q_elem | 
| An element in the message queue.  More... | |
| struct | msg_buffer | 
| The multi-threaded message buffer, implemented as a non-blocking list.  More... | |
Macros | |
| #define | q_elem_is_before(ma, mb) ((ma).t < (mb).t || ((ma).t == (mb).t && msg_is_before_extended(ma.m, mb.m))) | 
| Determine an ordering between two elements in a queue.  | |
Functions | |
| static __thread | heap_declare (struct q_elem) | 
| The private thread queue.  More... | |
| void | msg_queue_init (void) | 
| Initializes the message queue for the current thread.  | |
| void | msg_queue_fini (void) | 
| Finalizes the message queue for the current thread.  | |
| void | msg_queue_global_fini (void) | 
| Finalizes the message queue at the node level.  | |
| static void | msg_queue_insert_queued (void) | 
| Move the messages from the thread specific list into the thread private queue.  | |
| struct lp_msg * | msg_queue_extract (void) | 
| Extracts the next message from the queue.  More... | |
| simtime_t | msg_queue_time_peek (void) | 
| Peeks the timestamp of the next message from the queue.  More... | |
| void | msg_queue_insert (struct lp_msg *msg) | 
| Inserts a message in the queue.  More... | |
Variables | |
| static struct msg_buffer * | queues | 
| The buffers vector.  | |
Message queue datatype.
This is the message queue for the parallel runtime. The design is pretty simple. A queue for n threads is composed of a vector of n simpler private thread queues plus n public buffers. If thread t1 wants to send a message to thread t2 it puts a message in its buffer. Insertions are then cheap, while extractions simply empty the buffer into the private queue. This way the critically thread locked code is minimal.
      
  | 
  static | 
The private thread queue.
Initializes the message queue at the node level
| struct lp_msg* msg_queue_extract | ( | void | ) | 
Extracts the next message from the queue.
The extracted message is a best effort lowest timestamp for the current thread. Guaranteeing the lowest timestamp may increase the contention on the queues.
| void msg_queue_insert | ( | struct lp_msg * | msg | ) | 
Inserts a message in the queue.
| msg | the message to insert in the queue | 
| simtime_t msg_queue_time_peek | ( | void | ) | 
Peeks the timestamp of the next message from the queue.
This returns the lowest timestamp of the next message to be processed for the current thread. This is calculated in a precise fashion since this value is used in the gvt calculation.