Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cosmetic to make the code easier to read
[simgrid.git] / include / simgrid / actor.h
1 /* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #ifndef INCLUDE_SIMGRID_ACTOR_H_
7 #define INCLUDE_SIMGRID_ACTOR_H_
8
9 #include <simgrid/forward.h>
10 #include <xbt/base.h>
11 #include <xbt/dict.h>
12
13 /* C interface */
14 SG_BEGIN_DECL()
15 /** @brief Actor datatype.
16     @ingroup m_actor_management
17
18     An actor may be defined as a <em>code</em>, with some <em>private data</em>, executing in a <em>location</em>.
19
20     You should not access directly to the fields of the pointed structure, but always use the provided API to interact
21     with actors.
22  */
23 XBT_PUBLIC aid_t sg_actor_get_PID(sg_actor_t actor);
24 XBT_PUBLIC aid_t sg_actor_get_PPID(sg_actor_t actor);
25 XBT_PUBLIC sg_actor_t sg_actor_by_PID(aid_t pid);
26 XBT_PUBLIC const char* sg_actor_get_name(sg_actor_t actor);
27 XBT_PUBLIC sg_host_t sg_actor_get_host(sg_actor_t actor);
28 XBT_PUBLIC const char* sg_actor_get_property_value(sg_actor_t actor, const char* name);
29 XBT_PUBLIC xbt_dict_t sg_actor_get_properties(sg_actor_t actor);
30 XBT_PUBLIC void sg_actor_suspend(sg_actor_t actor);
31 XBT_PUBLIC void sg_actor_resume(sg_actor_t actor);
32 XBT_PUBLIC int sg_actor_is_suspended(sg_actor_t actor);
33 XBT_PUBLIC sg_actor_t sg_actor_restart(sg_actor_t actor);
34 void sg_actor_set_auto_restart(sg_actor_t actor, int auto_restart);
35 XBT_PUBLIC void sg_actor_daemonize(sg_actor_t actor);
36 XBT_PUBLIC void sg_actor_migrate(sg_actor_t process, sg_host_t host);
37 XBT_PUBLIC void sg_actor_join(sg_actor_t actor, double timeout);
38 XBT_PUBLIC void sg_actor_kill(sg_actor_t actor);
39 XBT_PUBLIC void sg_actor_kill_all();
40 XBT_PUBLIC void sg_actor_set_kill_time(sg_actor_t actor, double kill_time);
41 XBT_PUBLIC void sg_actor_yield();
42 XBT_PUBLIC void sg_actor_sleep_for(double duration);
43 XBT_PUBLIC sg_actor_t sg_actor_attach(const char* name, void* data, sg_host_t host, xbt_dict_t properties);
44 XBT_PUBLIC void sg_actor_detach();
45 XBT_PUBLIC sg_actor_t sg_actor_self();
46 XBT_PUBLIC aid_t sg_actor_self_get_pid();
47 XBT_PUBLIC aid_t sg_actor_self_get_ppid();
48 XBT_PUBLIC const char* sg_actor_self_get_name();
49 XBT_PUBLIC void sg_actor_self_execute(double flops);
50 XBT_PUBLIC void sg_actor_ref(sg_actor_t actor);
51 XBT_PUBLIC void sg_actor_unref(sg_actor_t actor);
52
53 SG_END_DECL()
54
55 #endif /* INCLUDE_SIMGRID_ACTOR_H_ */