X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f23b0fb864cb60978c1fcfd48d50f62dd054fe31..e080adacaf1ba847ad467f5b8d21da385636ed3c:/doc/doxygen/uhood_switch.doc diff --git a/doc/doxygen/uhood_switch.doc b/doc/doxygen/uhood_switch.doc index 7247341ac1..ff66dbf10f 100644 --- a/doc/doxygen/uhood_switch.doc +++ b/doc/doxygen/uhood_switch.doc @@ -27,7 +27,7 @@ Mimicking the OS behavior may seem over-engineered here, but this is mandatory to the model-checker. The simcalls, representing actors' actions, are the transitions of the formal system. Verifying the system requires to manipulate these transitions explicitly. This also -allows to run safely the actors in parallel, even if this is less +allows one to run the actors safely in parallel, even if this is less commonly used by our users. So, the key ideas here are: @@ -708,20 +708,15 @@ std::cv_status ConditionVariable::wait_for( simcall_cond_wait_timeout(cond_, lock.mutex()->mutex_, timeout); return std::cv_status::no_timeout; } - catch (xbt_ex& e) { - + catch (const simgrid::TimeoutException& e) { // If the exception was a timeout, we have to take the lock again: - if (e.category == timeout_error) { - try { - lock.mutex()->lock(); - return std::cv_status::timeout; - } - catch (...) { - std::terminate(); - } + try { + lock.mutex()->lock(); + return std::cv_status::timeout; + } + catch (...) { + std::terminate(); } - - std::terminate(); } catch (...) { std::terminate(); @@ -794,7 +789,7 @@ Reusing the same API as the C++ standard library is very useful because: This type of approach might be useful for other libraries which define their own contexts. An example of this is -[Mordor](https://github.com/mozy/mordor), a I/O library using fibers +[Mordor](https://github.com/mozy/mordor), an I/O library using fibers (cooperative scheduling): it implements cooperative/fiber [mutex](https://github.com/mozy/mordor/blob/4803b6343aee531bfc3588ffc26a0d0fdf14b274/mordor/fibersynchronization.h#L70), [recursive @@ -815,30 +810,14 @@ single-object without shared-state and synchronisation: @code{cpp} template class Result { - enum class ResultStatus { - invalid, - value, - exception, - }; public: - Result(); - ~Result(); - Result(Result const& that); - Result& operator=(Result const& that); - Result(Result&& that); - Result& operator=(Result&& that); bool is_valid() const; - void reset(); void set_exception(std::exception_ptr e); void set_value(T&& value); void set_value(T const& value); T get(); private: - ResultStatus status_ = ResultStatus::invalid; - union { - T value_; - std::exception_ptr exception_; - }; + boost::variant value_; }; @endcode~ @@ -974,4 +953,4 @@ auto makeTask(F code, Args... args) in the simulation which we would like to avoid. `std::try_lock()` should be safe to use though. -*/ \ No newline at end of file +*/