/******************************* Host simcalls ********************************/
#ifdef __cplusplus
XBT_PUBLIC e_smx_state_t simcall_execution_wait(const smx_activity_t& execution);
-XBT_PUBLIC e_smx_state_t simcall_execution_test(const smx_activity_t& execution);
+XBT_PUBLIC bool simcall_execution_test(const smx_activity_t& execution);
#endif
/**************************** Process simcalls ********************************/
XBT_PUBLIC unsigned int simcall_comm_waitany(simgrid::kernel::activity::CommImpl* comms[], size_t count,
double timeout);
XBT_PUBLIC void simcall_comm_wait(const smx_activity_t& comm, double timeout);
-XBT_PUBLIC int simcall_comm_test(const smx_activity_t& comm);
+XBT_PUBLIC bool simcall_comm_test(const smx_activity_t& comm);
XBT_PUBLIC int simcall_comm_testany(smx_activity_t comms[], size_t count);
XBT_PUBLIC int simcall_comm_testany(simgrid::kernel::activity::CommImpl* comms[], size_t count);
#endif
XBT_VERB("Activity %p is canceled", this);
if (surf_action_ != nullptr)
surf_action_->cancel();
+ state_ = SIMIX_CANCELED;
}
// boost::intrusive_ptr<Activity> support:
void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm)
{
- int res;
+ bool res;
if (MC_is_active() || MC_record_replay_is_active()) {
res = comm->src_actor_ && comm->dst_actor_;
void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* synchro)
{
- int res = (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING);
+ bool res = (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING);
if (res) {
synchro->simcalls_.push_back(simcall);
synchro->finish();
waiting_synchro->simcalls_.remove(&simcall);
} else if (sleep != nullptr) {
sleep->cancel();
- sleep->post();
+ sleep->finish();
} else if (raw != nullptr) {
raw->finish();
} else if (io != nullptr) {
io->cancel();
+ io->finish();
} else {
simgrid::kernel::activity::ActivityImplPtr activity = waiting_synchro;
xbt_die("Activity is of unknown type %s", simgrid::xbt::demangle(typeid(activity).name()).get());
return (e_smx_state_t)simcall_BODY_execution_wait(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
}
-e_smx_state_t simcall_execution_test(const smx_activity_t& execution)
+bool simcall_execution_test(const smx_activity_t& execution)
{
- return (e_smx_state_t)simcall_BODY_execution_test(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
+ return simcall_BODY_execution_test(static_cast<simgrid::kernel::activity::ExecImpl*>(execution.get()));
}
void simcall_process_join(smx_actor_t process, double timeout)
* @ingroup simix_comm_management
*
*/
-int simcall_comm_test(const smx_activity_t& comm)
+bool simcall_comm_test(const smx_activity_t& comm)
{
return simcall_BODY_comm_test(static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()));
}
{
simgrid::simix::marshal<simgrid::kernel::activity::ExecImpl*>(simcall->args[0], arg);
}
-static inline int simcall_execution_test__get__result(smx_simcall_t simcall)
+static inline bool simcall_execution_test__get__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<int>(simcall->result);
+ return simgrid::simix::unmarshal<bool>(simcall->result);
}
-static inline int simcall_execution_test__getraw__result(smx_simcall_t simcall)
+static inline bool simcall_execution_test__getraw__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
+ return simgrid::simix::unmarshal_raw<bool>(simcall->result);
}
-static inline void simcall_execution_test__set__result(smx_simcall_t simcall, int result)
+static inline void simcall_execution_test__set__result(smx_simcall_t simcall, bool result)
{
- simgrid::simix::marshal<int>(simcall->result, result);
+ simgrid::simix::marshal<bool>(simcall->result, result);
}
static inline smx_actor_t simcall_comm_send__get__sender(smx_simcall_t simcall)
{
simgrid::simix::marshal<simgrid::kernel::activity::CommImpl*>(simcall->args[0], arg);
}
-static inline int simcall_comm_test__get__result(smx_simcall_t simcall)
+static inline bool simcall_comm_test__get__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal<int>(simcall->result);
+ return simgrid::simix::unmarshal<bool>(simcall->result);
}
-static inline int simcall_comm_test__getraw__result(smx_simcall_t simcall)
+static inline bool simcall_comm_test__getraw__result(smx_simcall_t simcall)
{
- return simgrid::simix::unmarshal_raw<int>(simcall->result);
+ return simgrid::simix::unmarshal_raw<bool>(simcall->result);
}
-static inline void simcall_comm_test__set__result(smx_simcall_t simcall, int result)
+static inline void simcall_comm_test__set__result(smx_simcall_t simcall, bool result)
{
- simgrid::simix::marshal<int>(simcall->result, result);
+ simgrid::simix::marshal<bool>(simcall->result, result);
}
static inline simgrid::kernel::activity::CommImpl** simcall_comm_testany__get__comms(smx_simcall_t simcall)
return simcall<int, simgrid::kernel::activity::ExecImpl*>(SIMCALL_EXECUTION_WAIT, execution);
}
-inline static int simcall_BODY_execution_test(simgrid::kernel::activity::ExecImpl* execution)
+inline static bool simcall_BODY_execution_test(simgrid::kernel::activity::ExecImpl* execution)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_execution_test(&SIMIX_process_self()->simcall, execution);
- return simcall<int, simgrid::kernel::activity::ExecImpl*>(SIMCALL_EXECUTION_TEST, execution);
+ return simcall<bool, simgrid::kernel::activity::ExecImpl*>(SIMCALL_EXECUTION_TEST, execution);
}
inline static void simcall_BODY_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout)
return simcall<void, simgrid::kernel::activity::CommImpl*, double>(SIMCALL_COMM_WAIT, comm, timeout);
}
-inline static int simcall_BODY_comm_test(simgrid::kernel::activity::CommImpl* comm)
+inline static bool simcall_BODY_comm_test(simgrid::kernel::activity::CommImpl* comm)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
simcall_HANDLER_comm_test(&SIMIX_process_self()->simcall, comm);
- return simcall<int, simgrid::kernel::activity::CommImpl*>(SIMCALL_COMM_TEST, comm);
+ return simcall<bool, simgrid::kernel::activity::CommImpl*>(SIMCALL_COMM_TEST, comm);
}
inline static int simcall_BODY_comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count)
int process_sleep(double duration) [[block]];
int execution_wait(simgrid::kernel::activity::ExecImpl* execution) [[block]];
-int execution_test(simgrid::kernel::activity::ExecImpl* execution) [[block]];
+bool execution_test(simgrid::kernel::activity::ExecImpl* execution) [[block]];
void comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout) [[block]];
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, bool detached);
boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
int comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) [[block]];
void comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout) [[block]];
-int comm_test(simgrid::kernel::activity::CommImpl* comm) [[block]];
+bool comm_test(simgrid::kernel::activity::CommImpl* comm) [[block]];
int comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count) [[block]];
void mutex_lock(smx_mutex_t mutex) [[block]];
# smx_host_t h)
if self.simcalls_pre is None:
self.simcalls_pre = set()
- for fn in glob.glob('smx_*') + glob.glob('ActorImpl*') + \
+ for fn in glob.glob('smx_*') + glob.glob('../kernel/actor/ActorImpl*') + \
glob.glob('../mc/*cpp') + glob.glob('../kernel/activity/*cpp'):
f = open(fn)
self.simcalls_pre |= set(re.findall(r'simcall_HANDLER_(.*?)\(', f.read()))