A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git]
/
src
/
s4u
/
s4u_actor.cpp
diff --git
a/src/s4u/s4u_actor.cpp
b/src/s4u/s4u_actor.cpp
index
81d3323
..
1553bb9
100644
(file)
--- a/
src/s4u/s4u_actor.cpp
+++ b/
src/s4u/s4u_actor.cpp
@@
-11,7
+11,7
@@
#include "simgrid/s4u/Mailbox.hpp"
#include "src/kernel/context/Context.hpp"
#include "simgrid/s4u/Mailbox.hpp"
#include "src/kernel/context/Context.hpp"
-#include "src/simix/smx_private.h"
+#include "src/simix/smx_private.h
pp
"
#include <sstream>
#include <sstream>
@@
-62,7
+62,7
@@
void Actor::join() {
}
void Actor::setAutoRestart(bool autorestart) {
}
void Actor::setAutoRestart(bool autorestart) {
- sim
call_process_auto_restart_set(pimpl_,autorestart
);
+ sim
grid::simix::kernelImmediate([this, autorestart]() { pimpl_->auto_restart = autorestart; }
);
}
void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
}
void Actor::onExit(int_f_pvoid_pvoid_t fun, void* data)
@@
-75,7
+75,7
@@
void Actor::migrate(Host* new_host)
simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; });
}
simgrid::simix::kernelImmediate([this, new_host]() { pimpl_->new_host = new_host; });
}
-s4u::Host* Actor::
h
ost()
+s4u::Host* Actor::
getH
ost()
{
return this->pimpl_->host;
}
{
return this->pimpl_->host;
}
@@
-85,22
+85,22
@@
void Actor::daemonize()
simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); });
}
simgrid::simix::kernelImmediate([this]() { pimpl_->daemonize(); });
}
-const
char* Actor::cname()
+const
simgrid::xbt::string& Actor::getName() const
{
{
- return this->pimpl_->
name.c_str
();
+ return this->pimpl_->
getName
();
}
}
-simgrid::xbt::string Actor::name()
+const char* Actor::getCname() const
{
{
- return this->pimpl_->
name
;
+ return this->pimpl_->
getCname()
;
}
}
-aid_t Actor::
p
id()
+aid_t Actor::
getP
id()
{
return this->pimpl_->pid;
}
{
return this->pimpl_->pid;
}
-aid_t Actor::
p
pid()
+aid_t Actor::
getP
pid()
{
return this->pimpl_->ppid;
}
{
return this->pimpl_->ppid;
}
@@
-125,7
+125,7
@@
void Actor::setKillTime(double time) {
}
/** \brief Get the kill time of an actor(or 0 if unset). */
}
/** \brief Get the kill time of an actor(or 0 if unset). */
-double Actor::
k
illTime()
+double Actor::
getK
illTime()
{
return SIMIX_timer_get_date(pimpl_->kill_timer);
}
{
return SIMIX_timer_get_date(pimpl_->kill_timer);
}
@@
-134,7
+134,7
@@
void Actor::kill(aid_t pid)
{
smx_actor_t process = SIMIX_process_from_PID(pid);
if(process != nullptr) {
{
smx_actor_t process = SIMIX_process_from_PID(pid);
if(process != nullptr) {
- sim
call_process_kill(process
);
+ sim
grid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); }
);
} else {
std::ostringstream oss;
oss << "kill: ("<< pid <<") - No such process" << std::endl;
} else {
std::ostringstream oss;
oss << "kill: ("<< pid <<") - No such process" << std::endl;
@@
-147,7
+147,9
@@
smx_actor_t Actor::getImpl() {
}
void Actor::kill() {
}
void Actor::kill() {
- simcall_process_kill(pimpl_);
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate(
+ [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); });
}
// ***** Static functions *****
}
// ***** Static functions *****
@@
-172,16
+174,19
@@
void Actor::killAll(int resetPid)
}
/** Retrieve the property value (or nullptr if not set) */
}
/** Retrieve the property value (or nullptr if not set) */
-const char* Actor::
p
roperty(const char* key)
+const char* Actor::
getP
roperty(const char* key)
{
{
- return
(char*)xbt_dict_get_or_null(simcall_process_get_properties(pimpl_), key
);
+ return
simgrid::simix::kernelImmediate([this, key] { return pimpl_->getProperty(key); }
);
}
void Actor::setProperty(const char* key, const char* value)
{
}
void Actor::setProperty(const char* key, const char* value)
{
- simgrid::simix::kernelImmediate([this, key, value] {
- xbt_dict_set(simcall_process_get_properties(pimpl_), key, (char*)value, (void_f_pvoid_t) nullptr);
- });
+ simgrid::simix::kernelImmediate([this, key, value] { pimpl_->setProperty(key, value); });
+}
+
+Actor* Actor::restart()
+{
+ return simgrid::simix::kernelImmediate([this]() { return pimpl_->restart(); });
}
// ***** this_actor *****
}
// ***** this_actor *****
@@
-216,56
+221,69
@@
XBT_PUBLIC(void) sleep_until(double timeout)
simcall_process_sleep(timeout - now);
}
simcall_process_sleep(timeout - now);
}
-e_smx_state_t execute(double flops) {
+void execute(double flops)
+{
smx_activity_t s = simcall_execution_start(nullptr,flops,1.0/*priority*/,0./*bound*/);
smx_activity_t s = simcall_execution_start(nullptr,flops,1.0/*priority*/,0./*bound*/);
-
return
simcall_execution_wait(s);
+ simcall_execution_wait(s);
}
}
-void* recv(MailboxPtr chan) {
+void execute(double flops,double priority)
+{
+ smx_activity_t s = simcall_execution_start(nullptr,flops,1 / priority/*priority*/,0./*bound*/);
+ simcall_execution_wait(s);
+}
+
+void* recv(MailboxPtr chan) // deprecated
+{
return chan->get();
}
return chan->get();
}
-void* recv(MailboxPtr chan, double timeout)
+void* recv(MailboxPtr chan, double timeout)
// deprecated
{
return chan->get(timeout);
}
{
return chan->get(timeout);
}
-void send(MailboxPtr chan, void* payload, double simulatedSize)
+void send(MailboxPtr chan, void* payload, double simulatedSize)
// deprecated
{
chan->put(payload, simulatedSize);
}
{
chan->put(payload, simulatedSize);
}
-void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout)
+void send(MailboxPtr chan, void* payload, double simulatedSize, double timeout)
// deprecated
{
chan->put(payload, simulatedSize, timeout);
}
{
chan->put(payload, simulatedSize, timeout);
}
-CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize)
+CommPtr isend(MailboxPtr chan, void* payload, double simulatedSize)
// deprecated
{
return chan->put_async(payload, simulatedSize);
}
{
return chan->put_async(payload, simulatedSize);
}
-CommPtr irecv(MailboxPtr chan, void** data)
+CommPtr irecv(MailboxPtr chan, void** data)
// deprecated
{
return chan->get_async(data);
}
{
return chan->get_async(data);
}
-aid_t
p
id()
+aid_t
getP
id()
{
return SIMIX_process_self()->pid;
}
{
return SIMIX_process_self()->pid;
}
-aid_t
p
pid()
+aid_t
getP
pid()
{
return SIMIX_process_self()->ppid;
}
{
return SIMIX_process_self()->ppid;
}
-std::string name()
+std::string getName()
+{
+ return SIMIX_process_self()->getName();
+}
+
+const char* getCname()
{
{
- return SIMIX_process_self()->
name
;
+ return SIMIX_process_self()->
getCname()
;
}
}
-Host*
h
ost()
+Host*
getH
ost()
{
return SIMIX_process_self()->host;
}
{
return SIMIX_process_self()->host;
}
@@
-289,7
+307,8
@@
bool isSuspended()
void kill()
{
void kill()
{
- simcall_process_kill(SIMIX_process_self());
+ smx_actor_t process = SIMIX_process_self();
+ simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
}
void onExit(int_f_pvoid_pvoid_t fun, void* data)
}
void onExit(int_f_pvoid_pvoid_t fun, void* data)