X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d2cc5a5e537a7b2915f781dd75ad8f4d02f6fcf7..08f744b9a55745ac1b1dcf0ed2ea735471cd7f89:/include/simgrid/simix.hpp diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index 08bb97b713..9539451154 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -16,26 +16,8 @@ #include #include -namespace simgrid { -namespace kernel { -namespace actor { - -class Transition { -public: - virtual bool fireable() - { - return true; - } // whether this transition can currently be taken (if not, it could block the process) - virtual bool visible() { return true; } // whether the model-checker should pay any attention to this simcall - virtual std::string to_string() = 0; - virtual std::string dot_label() = 0; -}; -} // namespace actor -} // namespace kernel -} // namespace simgrid - -XBT_PUBLIC void simcall_run_kernel(std::function const& code, simgrid::kernel::actor::Transition* t); -XBT_PUBLIC void simcall_run_blocking(std::function const& code, simgrid::kernel::actor::Transition* t); +XBT_PUBLIC void simcall_run_kernel(std::function const& code, simgrid::mc::SimcallInspector* t); +XBT_PUBLIC void simcall_run_blocking(std::function const& code, simgrid::mc::SimcallInspector* t); namespace simgrid { namespace kernel { @@ -60,7 +42,7 @@ namespace actor { * you may need to wait for that mutex to be unlocked by its current owner. * Potentially blocking simcall must be issued using simcall_blocking(), right below in this file. */ -template typename std::result_of::type simcall(F&& code, Transition* t = nullptr) +template typename std::result_of::type simcall(F&& code, mc::SimcallInspector* t = nullptr) { // If we are in the maestro, we take the fast path and execute the // code directly without simcall mashalling/unmarshalling/dispatch: @@ -81,6 +63,9 @@ template typename std::result_of::type simcall(F&& code, Transiti * This is very similar to simcall() right above, but the calling actor will not get rescheduled until * actor->simcall_answer() is called explicitely. * + * Since the return value does not come from the lambda directly, its type cannot be guessed automatically and must + * be provided as template parameter. + * * This is meant for blocking actions. For example, locking a mutex is a blocking simcall. * First it's a simcall because that's obviously a modification of the world. Then, that's a blocking simcall because if * the mutex happens not to be free, the actor is added to a queue of actors in the mutex. Every mutex->unlock() takes @@ -90,7 +75,7 @@ template typename std::result_of::type simcall(F&& code, Transiti * * If your code never calls actor->simcall_answer() itself, the actor will never return from its simcall. */ -template typename std::result_of::type simcall_blocking(F&& code, Transition* t = nullptr) +template R simcall_blocking(F&& code, mc::SimcallInspector* t = nullptr) { // If we are in the maestro, we take the fast path and execute the // code directly without simcall mashalling/unmarshalling/dispatch: @@ -100,7 +85,6 @@ template typename std::result_of::type simcall_blocking(F&& code, // If we are in the application, pass the code to the maestro which // executes it for us and reports the result. We use a std::future which // conveniently handles the success/failure value for us. - typedef typename std::result_of::type R; simgrid::xbt::Result result; simcall_run_blocking([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward(code)); }, t); return result.get();