-// SerialUContext
-
-unsigned long SerialUContext::process_index_; /* index of the next process to run in the list of runnable processes */
-
-void SerialUContext::suspend()
-{
- /* determine the next context */
- SerialUContext* next_context;
- unsigned long int i = process_index_;
- process_index_++;
-
- if (i < simix_global->process_to_run.size()) {
- /* execute the next process */
- XBT_DEBUG("Run next process");
- next_context = static_cast<SerialUContext*>(simix_global->process_to_run[i]->context_);
- } else {
- /* all processes were run, return to maestro */
- XBT_DEBUG("No more process to run");
- next_context = static_cast<SerialUContext*>(UContext::get_maestro());
- }
- Context::set_current(next_context);
- UContext::swap(this, next_context);
-}
-
-void SerialUContext::resume()
-{
- Context::set_current(this);
- UContext::swap(UContext::get_maestro(), this);
-}
-
-void SerialUContext::run_all()
-{
- if (simix_global->process_to_run.empty())
- return;
- smx_actor_t first_process = simix_global->process_to_run.front();
- process_index_ = 1;
- static_cast<SerialUContext*>(first_process->context_)->resume();
-}
-