68 return list_head(lp->queue_in)->timestamp;
72 return evt->timestamp;
117 struct lp_struct *lp = find_lp_by_gid(msg->receiver);
122 #ifdef HAVE_PREEMPTION 136 msg_t *msg_to_process;
139 foreach_bound_lp(lp) {
141 while ((msg_to_process = get_msg(lp->bottom_halves)) != NULL) {
142 receiver = find_lp_by_gid(msg_to_process->receiver);
148 "The impossible happened: I'm receiving a message before the GVT\n");
151 if (
unlikely(!receive_control_msg(msg_to_process))) {
156 switch (msg_to_process->message_kind) {
161 statistics_post_data(receiver, STAT_ANTIMESSAGE, 1.0);
164 matched_msg =
list_tail(receiver->queue_in);
165 while (matched_msg != NULL
166 && matched_msg->mark !=
167 msg_to_process->mark) {
172 if (
unlikely(matched_msg == NULL)) {
174 "LP %d Received an antimessage, but no such mark has been found!\n",
177 rootsim_error(
true,
"Aborting...\n");
180 if (matched_msg->timestamp <=
lvt(receiver)) {
183 while ((receiver->
bound != NULL)
184 &&
D_EQUAL(receiver->
bound->timestamp, msg_to_process->timestamp)) {
188 receiver->
state = LP_STATE_ROLLBACK;
195 list_delete_by_content(receiver->queue_in,
212 if (msg_to_process->timestamp <
lvt(receiver)) {
215 while ((receiver->
bound != NULL)
216 &&
D_EQUAL(receiver->
bound->timestamp, msg_to_process->timestamp)) {
220 receiver->
state = LP_STATE_ROLLBACK;
231 if (!anti_control_message(msg_to_process)) {
239 rootsim_error(
true,
"Received a message which is neither positive nor negative. Aborting...\n");
250 #ifdef HAVE_PREEMPTION 272 unsigned long long k1 = (
unsigned long long)lp->
gid.
to_int;
273 unsigned long long k2 = lp->
mark++;
275 return (
unsigned long long)(((k1 + k2) * (k1 + k2 + 1) / 2) + k2);
void register_incoming_msg(const msg_t *msg)
Register an incoming message, if necessary.
msg_t * bound
Pointer to the last correctly processed event.
unsigned long long generate_mark(struct lp_struct *lp)
void process_bottom_halves(void)
#define likely(exp)
Optimize the branch as likely taken.
simtime_t next_event_timestamp(struct lp_struct *lp)
Message queueing subsystem.
A (M, 1) channel for messages.
Core ROOT-Sim functionalities.
msg_channel * bottom_halves
Bottom halves.
simtime_t get_last_gvt(void)
unsigned int to_int
The GID numerical value.
The ROOT-Sim scheduler main module header.
void dump_msg_content(msg_t *msg)
Dump the content of a message.
Generic thread management facilities.
#define list_insert(li, key_name, data)
Insert a new node in the list.
#define INFTY
Infinite timestamp: this is the highest timestamp in a simulation run.
double simtime_t
This defines the type with whom timestamps are represented.
Memory Manager main header.
unsigned long long mark
Unique identifier within the LP.
void validate_msg(msg_t *msg)
Perform some sanity checks on a message buffer.
#define D_EQUAL(a, b)
Equality condition for doubles.
void msg_release(msg_t *msg)
Release a message buffer.
GID_t gid
Global ID of the LP.
short unsigned int state
Current execution state of the LP.
void insert_bottom_half(msg_t *msg)
msg_t * advance_to_next_event(struct lp_struct *lp)
__thread unsigned int local_tid
Distributed GVT Support module.
unsigned int worker_thread
ID of the worker thread towards which the LP is bound.
#define unlikely(exp)
Optimize the branch as likely not taken.