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
replace SIMIX_process_auto_restart_set() with ActorImpl::set_auto_restart()
[simgrid.git]
/
src
/
s4u
/
s4u_Actor.cpp
diff --git
a/src/s4u/s4u_Actor.cpp
b/src/s4u/s4u_Actor.cpp
index
18339ed
..
220675b
100644
(file)
--- a/
src/s4u/s4u_Actor.cpp
+++ b/
src/s4u/s4u_Actor.cpp
@@
-71,10
+71,15
@@
void Actor::join(double timeout)
void Actor::set_auto_restart(bool autorestart)
{
void Actor::set_auto_restart(bool autorestart)
{
- simgrid::simix::simcall([this, autorestart]() { pimpl_->
auto_restart = autorestart
; });
+ simgrid::simix::simcall([this, autorestart]() { pimpl_->
set_auto_restart(autorestart)
; });
}
}
-void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data)
+void Actor::on_exit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
+{
+ simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
+}
+
+void Actor::on_exit(std::function<void(int, void*)> fun, void* data)
{
simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
}
{
simgrid::simix::simcall([this, fun, data] { SIMIX_process_on_exit(pimpl_, fun, data); });
}
@@
-109,7
+114,7
@@
void Actor::migrate(Host* new_host)
s4u::Host* Actor::get_host()
{
s4u::Host* Actor::get_host()
{
- return this->pimpl_->host;
+ return this->pimpl_->host
_
;
}
void Actor::daemonize()
}
void Actor::daemonize()
@@
-119,7
+124,7
@@
void Actor::daemonize()
bool Actor::is_daemon() const
{
bool Actor::is_daemon() const
{
- return this->pimpl_->is
D
aemon();
+ return this->pimpl_->is
_d
aemon();
}
const simgrid::xbt::string& Actor::get_name() const
}
const simgrid::xbt::string& Actor::get_name() const
@@
-134,12
+139,12
@@
const char* Actor::get_cname() const
aid_t Actor::get_pid() const
{
aid_t Actor::get_pid() const
{
- return this->pimpl_->pid;
+ return this->pimpl_->pid
_
;
}
aid_t Actor::get_ppid() const
{
}
aid_t Actor::get_ppid() const
{
- return this->pimpl_->ppid;
+ return this->pimpl_->ppid
_
;
}
void Actor::suspend()
}
void Actor::suspend()
@@
-154,9
+159,9
@@
void Actor::resume()
s4u::Actor::on_resume(this);
}
s4u::Actor::on_resume(this);
}
-
int
Actor::is_suspended()
+
bool
Actor::is_suspended()
{
{
- return simgrid::simix::simcall([this] { return pimpl_->suspended; });
+ return simgrid::simix::simcall([this] { return pimpl_->suspended
_
; });
}
void Actor::set_kill_time(double time)
}
void Actor::set_kill_time(double time)
@@
-212,20
+217,20
@@
void Actor::kill_all()
simgrid::simix::simcall([&self] { SIMIX_process_killall(self); });
}
simgrid::simix::simcall([&self] { SIMIX_process_killall(self); });
}
-std::map<std::string, std::string>* Actor::get_properties()
+std::
unordered_
map<std::string, std::string>* Actor::get_properties()
{
{
- return simgrid::simix::simcall([this] { return this->pimpl_->get
P
roperties(); });
+ return simgrid::simix::simcall([this] { return this->pimpl_->get
_p
roperties(); });
}
/** Retrieve the property value (or nullptr if not set) */
const char* Actor::get_property(const char* key)
{
}
/** Retrieve the property value (or nullptr if not set) */
const char* Actor::get_property(const char* key)
{
- return simgrid::simix::simcall([this, key] { return pimpl_->get
P
roperty(key); });
+ return simgrid::simix::simcall([this, key] { return pimpl_->get
_p
roperty(key); });
}
void Actor::set_property(const char* key, const char* value)
{
}
void Actor::set_property(const char* key, const char* value)
{
- simgrid::simix::simcall([this, key, value] { pimpl_->set
P
roperty(key, value); });
+ simgrid::simix::simcall([this, key, value] { pimpl_->set
_p
roperty(key, value); });
}
Actor* Actor::restart()
}
Actor* Actor::restart()
@@
-316,12
+321,12
@@
ExecPtr exec_async(double flops)
aid_t get_pid()
{
aid_t get_pid()
{
- return SIMIX_process_self()->pid;
+ return SIMIX_process_self()->pid
_
;
}
aid_t get_ppid()
{
}
aid_t get_ppid()
{
- return SIMIX_process_self()->ppid;
+ return SIMIX_process_self()->ppid
_
;
}
std::string get_name()
}
std::string get_name()
@@
-336,7
+341,7
@@
const char* get_cname()
Host* get_host()
{
Host* get_host()
{
- return SIMIX_process_self()->host;
+ return SIMIX_process_self()->host
_
;
}
void suspend()
}
void suspend()
@@
-357,7
+362,7
@@
void resume()
bool is_suspended()
{
smx_actor_t process = SIMIX_process_self();
bool is_suspended()
{
smx_actor_t process = SIMIX_process_self();
- return simgrid::simix::simcall([process] { return process->suspended; });
+ return simgrid::simix::simcall([process] { return process->suspended
_
; });
}
void kill()
}
void kill()
@@
-366,7
+371,7
@@
void kill()
simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); });
}
simgrid::simix::simcall([process] { SIMIX_process_kill(process, process); });
}
-void on_exit(
int_f_pvoid_pvoid_t
fun, void* data)
+void on_exit(
std::function<void(int, void*)>
fun, void* data)
{
SIMIX_process_self()->iface()->on_exit(fun, data);
}
{
SIMIX_process_self()->iface()->on_exit(fun, data);
}
@@
-408,9
+413,13
@@
bool isSuspended() /* deprecated */
{
return is_suspended();
}
{
return is_suspended();
}
-void onExit /* deprecated */ (int_f_pvoid_pvoid_t fun, void* data)
+void on_exit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
+{
+ SIMIX_process_self()->iface()->on_exit([fun](int a, void* b) { fun((void*)(intptr_t)a, b); }, data);
+}
+void onExit(int_f_pvoid_pvoid_t fun, void* data) /* deprecated */
{
{
- on_exit(
fun
, data);
+ on_exit(
[fun](int a, void* b) { fun((void*)(intptr_t)a, b); }
, data);
}
} // namespace this_actor
}
} // namespace this_actor
@@
-491,11
+500,11
@@
xbt_dict_t sg_actor_get_properties(sg_actor_t actor)
{
xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
{
xbt_assert(actor != nullptr, "Invalid parameter: First argument must not be nullptr");
xbt_dict_t as_dict = xbt_dict_new_homogeneous(xbt_free_f);
- std::map<std::string, std::string>* props = actor->get_properties();
+ std::
unordered_
map<std::string, std::string>* props = actor->get_properties();
if (props == nullptr)
return nullptr;
if (props == nullptr)
return nullptr;
- for (auto const&
elm
: *props) {
- xbt_dict_set(as_dict,
elm.first.c_str(), xbt_strdup(elm
.second.c_str()), nullptr);
+ for (auto const&
kv
: *props) {
+ xbt_dict_set(as_dict,
kv.first.c_str(), xbt_strdup(kv
.second.c_str()), nullptr);
}
return as_dict;
}
}
return as_dict;
}