ROOT-Sim core  3.0.0-rc.2
A General-Purpose Multi-threaded Parallel/Distributed Simulation Library
Functions
msg_allocator.h File Reference

Memory management functions for messages. More...

#include <lp/msg.h>
#include <memory.h>
Include dependency graph for msg_allocator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void msg_allocator_init (void)
 Initialize the message allocator thread-local data structures.
 
void msg_allocator_fini (void)
 Finalize the message allocator thread-local data structures.
 
struct lp_msgmsg_allocator_alloc (unsigned payload_size)
 Allocate a new message with given payload size. More...
 
void msg_allocator_free (struct lp_msg *msg)
 Free a message. More...
 
void msg_allocator_free_at_gvt (struct lp_msg *msg)
 Free a message after its destination time is committed. More...
 
void msg_allocator_on_gvt (simtime_t current_gvt)
 Free the committed messages after a new GVT has been computed. More...
 
static struct lp_msgmsg_allocator_pack (lp_id_t receiver, simtime_t timestamp, unsigned event_type, const void *payload, unsigned payload_size)
 

Detailed Description

Memory management functions for messages.

Memory management functions for messages

Function Documentation

◆ msg_allocator_alloc()

struct lp_msg* msg_allocator_alloc ( unsigned  payload_size)

Allocate a new message with given payload size.

Parameters
payload_sizethe size in bytes of the requested message payload
Returns
a new message with at least the requested amount of payload space

Since this module relies on the member lp_msg.pl_size (see msg_allocator_free()), it has writing responsibility on it.

◆ msg_allocator_free()

void msg_allocator_free ( struct lp_msg msg)

Free a message.

Parameters
msga pointer to the message to release

◆ msg_allocator_free_at_gvt()

void msg_allocator_free_at_gvt ( struct lp_msg msg)

Free a message after its destination time is committed.

Parameters
msga pointer to the message to release

◆ msg_allocator_on_gvt()

void msg_allocator_on_gvt ( simtime_t  current_gvt)

Free the committed messages after a new GVT has been computed.

Parameters
current_gvtthe latest value of the GVT