void simcall_call(smx_process_t process) { if (process != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", process->name, SIMIX_simcall_name(process->simcall.call), (int)process->simcall.call); SIMIX_process_yield(process); } else { SIMIX_simcall_handle(&process->simcall, 0); } }
/** * \brief Makes the current process do a simcall to the kernel and yields * until completion. If the current thread is maestro, we don't yield and * execute the simcall directly. * \param self the current process */ void SIMIX_simcall_push(smx_process_t self) { if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { XBT_DEBUG("I'm the maestro, execute the simcall directly"); SIMIX_simcall_pre(&self->simcall, 0); } }
inline static R simcall(e_smx_simcall_t call, T const&... t) { smx_actor_t self = SIMIX_process_self(); simgrid::simix::marshal(&self->simcall, call, t...); if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name.c_str(), SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { SIMIX_simcall_handle(&self->simcall, 0); } return simgrid::simix::unmarshal<R>(self->simcall.result); }
void SIMIX_request_push() { xbt_swag_t req_table; smx_process_t issuer = SIMIX_process_self(); if (issuer != simix_global->maestro_process){ issuer->request.issuer = issuer; req_table = SIMIX_request_get_reqlist(SIMIX_context_get_thread_id()); xbt_swag_insert_at_tail(&issuer->request, req_table); XBT_DEBUG("Pushed request %s (%d) of %s", SIMIX_request_name(issuer->request.call), issuer->request.call, issuer->name); XBT_DEBUG("Yield process '%s' on request of type %s (%d)", issuer->name, SIMIX_request_name(issuer->request.call), issuer->request.call); SIMIX_process_yield(); } else { SIMIX_request_pre(&issuer->request, 0); } }
void xbt_thread_yield(void) { SIMIX_process_yield(SIMIX_process_self()); }