XBT_PUBLIC(int) _xbt_replay_is_active(void);
-XBT_PUBLIC(void) _xbt_replay_action_init(void);
+XBT_PUBLIC(int) _xbt_replay_action_init(void);
XBT_PUBLIC(void) _xbt_replay_action_exit(void);
XBT_PUBLIC(void) xbt_replay_action_register(const char *action_name,
TRACE_smpi_collective_in(rank, -1, __FUNCTION__, extra);
TRACE_smpi_collective_out(rank, -1, __FUNCTION__);
- if (!action_funs){
- _xbt_replay_action_init();
+ if (!_xbt_replay_action_init()) {
xbt_replay_action_register("init", action_init);
xbt_replay_action_register("finalize", action_finalize);
xbt_replay_action_register("comm_size", action_comm_size);
FILE *action_fp;
-xbt_dict_t action_funs;
-xbt_dict_t action_queues;
+xbt_dict_t action_funs = NULL;
+xbt_dict_t action_queues = NULL;
static char *action_line = NULL;
static size_t action_len = 0;
xbt_free(lowername);
}
-void _xbt_replay_action_init(void)
+/** @brief Initializes the replay mechanism, and returns true if (and only if) it was necessary
+ *
+ * It returns false if it was already done by another process.
+ */
+int _xbt_replay_action_init(void)
{
+ if (action_funs)
+ return 0;
is_replay_active = 1;
action_funs = xbt_dict_new_homogeneous(NULL);
action_queues = xbt_dict_new_homogeneous(NULL);
+ return 1;
}
void _xbt_replay_action_exit(void)
xbt_dict_free(&action_queues);
xbt_dict_free(&action_funs);
free(action_line);
+ action_queues = NULL;
+ action_funs = NULL;
+ action_line = NULL;
}
/**