XBT_PUBLIC e_smx_state_t simcall_execution_wait(simgrid::kernel::activity::ActivityImpl* execution, double timeout);
XBT_PUBLIC unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count,
double timeout);
-XBT_PUBLIC bool simcall_execution_test(simgrid::kernel::activity::ActivityImpl* execution);
+XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Exec::test()") XBT_PUBLIC
+ bool simcall_execution_test(simgrid::kernel::activity::ActivityImpl* execution);
+XBT_ATTRIB_DEPRECATED_v330("Please use s4u::Exec::test()") XBT_PUBLIC
+ bool simcall_execution_test(const simgrid::kernel::activity::ActivityImplPtr& execution);
XBT_ATTRIB_DEPRECATED_v330("Please use an ActivityImpl* for first parameter") inline e_smx_state_t
simcall_execution_wait(const simgrid::kernel::activity::ActivityImplPtr& execution, double timeout)
{
return simcall_execution_wait(execution.get(), timeout);
}
-XBT_ATTRIB_DEPRECATED_v330("Please use an ActivityImpl* for first parameter") inline bool simcall_execution_test(
- const simgrid::kernel::activity::ActivityImplPtr& execution)
-{
- return simcall_execution_test(execution.get());
-}
#endif
/**************************** Process simcalls ********************************/
return surf_action_ ? surf_action_->get_remains() : 0;
}
+bool ActivityImpl::test()
+{
+ if (state_ != State::WAITING && state_ != State::RUNNING) {
+ finish();
+ return true;
+ }
+ return false;
+}
+
void ActivityImpl::suspend()
{
if (surf_action_ == nullptr)
std::list<smx_simcall_t> simcalls_; /* List of simcalls waiting for this activity */
resource::Action* surf_action_ = nullptr;
+ bool test();
+
virtual void suspend();
virtual void resume();
virtual void cancel();
}
}
-void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* synchro)
-{
- bool res = (synchro->state_ != simgrid::kernel::activity::State::WAITING &&
- synchro->state_ != simgrid::kernel::activity::State::RUNNING);
- if (res) {
- synchro->simcalls_.push_back(simcall);
- synchro->finish();
- } else {
- simcall->issuer_->simcall_answer();
- }
- simcall_execution_test__set__result(simcall, res);
-}
-
void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execs[],
size_t count, double timeout)
{
if (state_ == State::INITED || state_ == State::STARTING)
this->vetoable_start();
- if (simcall_execution_test(get_impl())) {
+ if (kernel::actor::simcall([this] { return this->get_impl()->test(); })) {
state_ = State::FINISHED;
this->release_dependencies();
return true;
timeout);
}
-bool simcall_execution_test(simgrid::kernel::activity::ActivityImpl* execution)
+bool simcall_execution_test(simgrid::kernel::activity::ActivityImpl* execution) // XBT_ATTRIB_DEPRECATED_v330
{
- return simcall_BODY_execution_test(static_cast<simgrid::kernel::activity::ExecImpl*>(execution));
+ return simgrid::kernel::actor::simcall([execution] { return execution->test(); });
}
unsigned int simcall_execution_waitany_for(simgrid::kernel::activity::ExecImpl* execs[], size_t count, double timeout)
simgrid::simix::marshal<int>(simcall->result_, result);
}
-static inline simgrid::kernel::activity::ExecImpl* simcall_execution_test__get__execution(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall->args_[0]);
-}
-static inline simgrid::kernel::activity::ExecImpl* simcall_execution_test__getraw__execution(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ExecImpl*>(simcall->args_[0]);
-}
-static inline void simcall_execution_test__set__execution(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* arg)
-{
- simgrid::simix::marshal<simgrid::kernel::activity::ExecImpl*>(simcall->args_[0], arg);
-}
-static inline bool simcall_execution_test__get__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<bool>(simcall->result_);
-}
-static inline bool simcall_execution_test__getraw__result(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<bool>(simcall->result_);
-}
-static inline void simcall_execution_test__set__result(smx_simcall_t simcall, bool result)
-{
- simgrid::simix::marshal<bool>(simcall->result_, result);
-}
-
static inline smx_actor_t simcall_comm_send__get__sender(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_actor_t>(simcall->args_[0]);
XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution, double timeout);
XBT_PRIVATE void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout);
-XBT_PRIVATE void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::activity::ExecImpl* execution);
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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);
XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate);
return simcall<int, simgrid::kernel::activity::ExecImpl**, size_t, double>(SIMCALL_EXECUTION_WAITANY_FOR, execs, count, timeout);
}
-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<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, unsigned char* 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)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
SIMCALL_NONE,
SIMCALL_EXECUTION_WAIT,
SIMCALL_EXECUTION_WAITANY_FOR,
- SIMCALL_EXECUTION_TEST,
SIMCALL_COMM_SEND,
SIMCALL_COMM_ISEND,
SIMCALL_COMM_RECV,
"SIMCALL_NONE",
"SIMCALL_EXECUTION_WAIT",
"SIMCALL_EXECUTION_WAITANY_FOR",
- "SIMCALL_EXECUTION_TEST",
"SIMCALL_COMM_SEND",
"SIMCALL_COMM_ISEND",
"SIMCALL_COMM_RECV",
simcall_HANDLER_execution_waitany_for(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args_[0]), simgrid::simix::unmarshal<size_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]));
break;
- case SIMCALL_EXECUTION_TEST:
- simcall_HANDLER_execution_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args_[0]));
- break;
-
case SIMCALL_COMM_SEND:
simcall_HANDLER_comm_send(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]), simgrid::simix::unmarshal<double>(simcall.args_[3]), simgrid::simix::unmarshal<unsigned char*>(simcall.args_[4]), simgrid::simix::unmarshal<size_t>(simcall.args_[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args_[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args_[7]), simgrid::simix::unmarshal<void*>(simcall.args_[8]), simgrid::simix::unmarshal<double>(simcall.args_[9]));
break;
int execution_wait(simgrid::kernel::activity::ExecImpl* execution, double timeout) [[block]];
int execution_waitany_for(simgrid::kernel::activity::ExecImpl** execs, size_t count, double timeout) [[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, unsigned char* 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, unsigned char* 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);