Memory management functions for messages.
More...
Memory management functions for messages.
Memory management functions for messages
- Copyright
- Copyright (C) 2008-2022 HPDCS Group https://hpdcs.github.io
◆ msg_allocator_alloc()
struct lp_msg* msg_allocator_alloc |
( |
unsigned |
payload_size | ) |
|
Allocate a new message with given payload size.
- Parameters
-
payload_size | the 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
-
msg | a 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
-
msg | a 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_gvt | the latest value of the GVT |
◆ msg_allocator_pack()
struct lp_msg* msg_allocator_pack |
( |
lp_id_t |
receiver, |
|
|
simtime_t |
timestamp, |
|
|
unsigned |
event_type, |
|
|
const void * |
payload, |
|
|
unsigned |
payload_size |
|
) |
| |
Allocate a new message and populate it.
- Parameters
-
receiver | the id of the LP which must receive this message |
timestamp | the logical time at which this message must be processed |
event_type | a field which can be used by the model to distinguish them |
payload | the payload to copy into the message |
payload_size | the size in bytes of the payload to copy into the message |
- Returns
- a new populated message