memory gets properly reclaimed. This call should be at the end of the
actor's function, not in a on_exit callback.
+.. _s4u_raii:
+
Memory Management
*****************
.. autodoxyclass:: simgrid::s4u::Actor
-.. doxygentypedef:: ActorPtr
-
.. doxygentypedef:: aid_t
-Creating actors
----------------
+Basic management
+----------------
.. tabs::
.. code:: C++
- #include <simgrid/s4u/Engine.hpp>
+ #include <simgrid/s4u/Actor.hpp>
+
+ .. doxygentypedef:: ActorPtr
+
+ .. group-tab:: Python
+
+ .. code:: Python
+
+ from simgrid import Actor
+
+ .. group-tab:: C
+
+ .. code:: C
+
+ #include <simgrid/actor.h>
+
+ .. doxygentypedef:: sg_actor_t
+ .. cpp:type:: const s4u_Actor* const_sg_actor_t
+
+ Pointer to a constant actor object.
+
+ .. autodoxymethod:: sg_actor_ref(const_sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_unref(const_sg_actor_t actor)
+
+Creating actors
+---------------
+
+.. tabs::
+
+ .. group-tab:: C++
.. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, const std::function< void()> &code)
.. autodoxymethod:: simgrid::s4u::Actor::create(const std::string &name, s4u::Host *host, F code)
.. group-tab:: Python
- .. code:: Python
-
- from simgrid import Actor
-
.. automethod:: simgrid.Actor.create
.. group-tab:: C
- .. code:: C
-
- #include <simgrid/actor.h>
-
.. autodoxymethod:: sg_actor_init(const char *name, sg_host_t host)
.. autodoxymethod:: sg_actor_start(sg_actor_t actor, xbt_main_func_t code, int argc, char **argv)
.. autodoxymethod:: sg_actor_attach(const char *name, void *data, sg_host_t host, xbt_dict_t properties)
.. autodoxymethod:: sg_actor_detach()
- .. autodoxymethod:: sg_actor_ref(sg_actor_t actor)
- .. autodoxymethod:: sg_actor_unref(sg_actor_t actor)
-
-Searching specific actors
--------------------------
+Retrieving actors
+-----------------
.. tabs::
.. autodoxymethod:: sg_actor_by_PID(aid_t pid)
.. autodoxymethod:: sg_actor_self()
-Querying info about actors
---------------------------
+Querying info
+-------------
.. tabs::
.. group-tab:: C
- .. autodoxymethod:: sg_actor_get_name(sg_actor_t actor)
- .. autodoxymethod:: sg_actor_get_PID(sg_actor_t actor)
- .. autodoxymethod:: sg_actor_get_PPID(sg_actor_t actor)
- .. autodoxymethod:: sg_actor_get_properties(sg_actor_t actor)
- .. autodoxymethod:: sg_actor_get_property_value(sg_actor_t actor, const char *name)
+ .. autodoxymethod:: sg_actor_get_name(const_sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_get_PID(const_sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_get_PPID(const_sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_get_properties(const_sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_get_property_value(const_sg_actor_t actor, const char *name)
- .. autodoxymethod:: sg_actor_get_host(sg_actor_t actor)
+ .. autodoxymethod:: sg_actor_get_host(const_sg_actor_t actor)
.. autodoxymethod:: sg_actor_set_host(sg_actor_t actor, sg_host_t host)
.. autodoxymethod:: sg_actor_data(const_sg_actor_t actor)
The current actor
====================
-Static methods working on the current actor (see :ref:`API_s4u_Actor`).
+These functions can be used in your user code to interact with the actor
+currently running (the one retrieved with :cpp:func:`simgrid::s4u::Actor::self`).
+Using these functions can greatly improve the code readability.
+
+Querying info
+-------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::get_cname()
+ .. autodoxymethod:: simgrid::s4u::this_actor::get_name()
+ .. autodoxymethod:: simgrid::s4u::this_actor::get_pid()
+ .. autodoxymethod:: simgrid::s4u::this_actor::get_ppid()
+ .. autodoxymethod:: simgrid::s4u::this_actor::is_maestro()
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::get_host()
+ .. autodoxymethod:: simgrid::s4u::this_actor::set_host(Host *new_host)
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.get_host
+ .. autofunction:: simgrid.this_actor.set_host
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_actor_self_data()
+ .. autodoxymethod:: sg_actor_self_data_set(void *data)
+ .. autodoxymethod:: sg_actor_self_get_name()
+ .. autodoxymethod:: sg_actor_self_get_pid()
+ .. autodoxymethod:: sg_actor_self_get_ppid()
+ .. autodoxymethod:: sg_host_self()
+ .. autodoxymethod:: sg_host_self_get_name()
+
+Suspending and resuming
+-----------------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::suspend()
+ .. autodoxymethod:: simgrid::s4u::this_actor::yield()
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.suspend
+ .. autofunction:: simgrid.this_actor.yield_
+
+Logging messages
+----------------
+
+.. tabs::
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.info
+ .. autofunction:: simgrid.this_actor.error
+
+Sleeping
+--------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::sleep_for(double duration)
+ .. autodoxymethod:: simgrid::s4u::this_actor::sleep_for(std::chrono::duration< Rep, Period > duration)
+ .. autodoxymethod:: simgrid::s4u::this_actor::sleep_until(const SimulationTimePoint< Duration > &wakeup_time)
+ .. autodoxymethod:: simgrid::s4u::this_actor::sleep_until(double wakeup_time)
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.sleep_for
+ .. autofunction:: simgrid.this_actor.sleep_until
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_actor_sleep_for(double duration)
+
+Simulating executions
+---------------------
+
+Simulate the execution of some code on this actor. You can either simulate
+parallel or sequential code, and you can either block upon the termination of
+the execution, or start an asynchronous activity.
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::exec_async(double flops_amounts)
+ .. autodoxymethod:: simgrid::s4u::this_actor::exec_init(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts)
+ .. autodoxymethod:: simgrid::s4u::this_actor::exec_init(double flops_amounts)
+ .. autodoxymethod:: simgrid::s4u::this_actor::execute(double flop)
+ .. autodoxymethod:: simgrid::s4u::this_actor::execute(double flop, double priority)
+ .. autodoxymethod:: simgrid::s4u::this_actor::parallel_execute(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts)
+ .. autodoxymethod:: simgrid::s4u::this_actor::parallel_execute(const std::vector< s4u::Host * > &hosts, const std::vector< double > &flops_amounts, const std::vector< double > &bytes_amounts, double timeout)
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.exec_init
+ .. autofunction:: simgrid.this_actor.execute
+
+ .. group-tab:: C
-.. doxygennamespace:: simgrid::s4u::this_actor
+ .. autodoxymethod:: sg_actor_self_execute(double flops)
+
+Exiting
+-------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::this_actor::exit()
+ .. autodoxymethod:: simgrid::s4u::this_actor::on_exit(const std::function< void(bool)> &fun)
+
+ .. group-tab:: Python
+
+ .. autofunction:: simgrid.this_actor.exit
+ .. autofunction:: simgrid.this_actor.on_exit
.. _API_s4u_Engine:
.. automethod:: simgrid.Engine.get_all_hosts
+ .. group-tab:: C
+
+ See also :cpp:func:`sg_host_list` and :cpp:func:`sg_host_count`.
+
Retrieving links
----------------
.. autodoxymethod:: simgrid::s4u::Engine::get_netzone_root()
.. autodoxymethod:: simgrid::s4u::Engine::netpoint_by_name_or_null(const std::string &name)
.. autodoxymethod:: simgrid::s4u::Engine::netzone_by_name_or_null(const std::string &name)
- .. autodoxymethod:: simgrid::s4u::Engine::set_netzone_root(NetZone *netzone)
+ .. autodoxymethod:: simgrid::s4u::Engine::set_netzone_root(const NetZone *netzone)
Signals
-------
class Mailbox
================
+.. autodoxyclass:: simgrid::s4u::Mailbox
+
Please also refer to the :ref:`full doc on s4u::Mailbox <s4u_mailbox>`.
-.. doxygenclass:: simgrid::s4u::Mailbox
- :members:
- :protected-members:
- :undoc-members:
+Basic management
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. code-block:: C++
+
+ #include <simgrid/s4u/Mailbox.hpp>
+
+ Note that there is no MailboxPtr type, and that you cannot use the RAII
+ idiom on mailboxes because they are internal objects to the simulation
+ engine. Once created, there is no way to destroy a mailbox before the end
+ of the simulation.
+
+ .. autodoxymethod:: simgrid::s4u::Mailbox::by_name(const std::string &name)
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Mailbox.by_name
+
+Querying info
+-------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get_cname()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get_name()
+
+ .. group-tab:: Python
+
+ .. autoattribute:: simgrid.Mailbox.name
+
+Sending data
+------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Mailbox::put(void *payload, uint64_t simulated_size_in_bytes)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::put(void *payload, uint64_t simulated_size_in_bytes, double timeout)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::put_async(void *data, uint64_t simulated_size_in_bytes)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::put_init()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::put_init(void *data, uint64_t simulated_size_in_bytes)
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Mailbox.put
+ .. automethod:: simgrid.Mailbox.put_async
+
+
+Receiving data
+--------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Mailbox::empty()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::front()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get(double timeout)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get_async(void **data)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get_init()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::iprobe(int type, bool(*match_fun)(void *, void *, kernel::activity::CommImpl *), void *data)
+ .. autodoxymethod:: simgrid::s4u::Mailbox::listen()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::ready()
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Mailbox.get
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_mailbox_listen(const char *alias)
+
+Receiving actor
+---------------
+
+See :ref:`s4u_receiving_actor`.
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Mailbox::get_receiver()
+ .. autodoxymethod:: simgrid::s4u::Mailbox::set_receiver(ActorPtr actor)
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: ::sg_mailbox_set_receiver(const char *alias)
+
.. _API_s4u_Resource:
=========
class Disk
=============
-.. doxygenclass:: simgrid::s4u::Disk
- :members:
- :protected-members:
- :undoc-members:
+.. autodoxyclass:: simgrid::s4u::Disk
+
+Basic management
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. code-block:: C++
+
+ #include <simgrid/s4u/Disk.hpp>
+ Note that there is no DiskPtr type, and that you cannot use the RAII
+ idiom on disks because SimGrid does not allow (yet) to create nor
+ destroy resources once the simulation is started.
+
+
+Querying info
+-------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Disk::get_cname()
+ .. autodoxymethod:: simgrid::s4u::Disk::get_host()
+ .. autodoxymethod:: simgrid::s4u::Disk::get_name()
+ .. autodoxymethod:: simgrid::s4u::Disk::get_properties()
+ .. autodoxymethod:: simgrid::s4u::Disk::get_property(const std::string &key)
+ .. autodoxymethod:: simgrid::s4u::Disk::get_read_bandwidth()
+ .. autodoxymethod:: simgrid::s4u::Disk::get_write_bandwidth()
+ .. autodoxymethod:: simgrid::s4u::Disk::set_property(const std::string &, const std::string &value)
+
+I/O operations
+--------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Disk::io_init(sg_size_t size, s4u::Io::OpType type)
+ .. autodoxymethod:: simgrid::s4u::Disk::read(sg_size_t size)
+ .. autodoxymethod:: simgrid::s4u::Disk::read_async(sg_size_t size)
+ .. autodoxymethod:: simgrid::s4u::Disk::write(sg_size_t size)
+ .. autodoxymethod:: simgrid::s4u::Disk::write_async(sg_size_t size)
+
+Signals
+-------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxyvar:: simgrid::s4u::Disk::on_creation
+ .. autodoxyvar:: simgrid::s4u::Disk::on_destruction
+ .. autodoxyvar:: simgrid::s4u::Disk::on_state_change
.. _API_s4u_Host:
class Host
=============
+.. autodoxyclass:: simgrid::s4u::Host
+
+Basic management
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. code-block:: C++
+
+ #include <simgrid/s4u/Host.hpp>
+
+ Note that there is no HostPtr type, and that you cannot use the RAII
+ idiom on hosts because SimGrid does not allow (yet) to create nor
+ destroy resources once the simulation is started.
+
+ .. group-tab:: Python
+
+ .. code:: Python
+
+ from simgrid import Host
+
+ .. group-tab:: C
+
+ .. code:: C
+
+ #include <simgrid/host.h>
+
+ .. doxygentypedef:: sg_host_t
+ .. cpp:type:: const s4u_Host* const_sg_host_t
+
+ Pointer to a constant host object.
+
+Retrieving hosts
+----------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ See also :cpp:func:`simgrid::s4u::Engine::get_all_hosts`.
+
+ .. autodoxymethod:: simgrid::s4u::Host::by_name(const std::string &name)
+ .. autodoxymethod:: simgrid::s4u::Host::by_name_or_null(const std::string &name)
+ .. autodoxymethod:: simgrid::s4u::Host::current()
+
+ .. group-tab:: Python
+
+ See also :py:func:`simgrid.Engine.get_all_hosts`.
+
+ .. automethod:: simgrid.Host.by_name
+ .. automethod:: simgrid.Host.current
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_host_by_name(const char *name)
+ .. autodoxymethod:: sg_host_count()
+ .. autodoxymethod:: sg_host_list()
+ .. autodoxymethod:: sg_hosts_as_dynar()
+
+Querying info
+-------------
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Host::get_cname()
+ .. autodoxymethod:: simgrid::s4u::Host::get_core_count()
+ .. autodoxymethod:: simgrid::s4u::Host::get_disks()
+ .. autodoxymethod:: simgrid::s4u::Host::get_name()
+
+ .. group-tab:: Python
+
+ .. autoattribute:: simgrid.Exec.host
+ .. autoattribute:: simgrid.Host.name
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: ::sg_host_core_count(const_sg_host_t host)
+ .. autodoxymethod:: sg_host_get_name(const_sg_host_t host)
+
+DVFS
+----
+
+.. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Host::get_pstate()
+ .. autodoxymethod:: simgrid::s4u::Host::get_pstate_count()
+ .. autodoxymethod:: simgrid::s4u::Host::get_pstate_speed(int pstate_index)
+ .. autodoxymethod:: simgrid::s4u::Host::set_pstate(int pstate_index)
+ .. autodoxymethod:: simgrid::s4u::Host::set_speed_profile(kernel::profile::Profile *p)
+ .. autodoxymethod:: simgrid::s4u::Host::set_state_profile(kernel::profile::Profile *p)
+
+ .. group-tab:: Python
+
+ .. automethod:: simgrid.Host.get_pstate_count
+ .. automethod:: simgrid.Host.get_pstate_speed
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_host_get_available_speed(const_sg_host_t host)
+ .. autodoxymethod:: sg_host_get_nb_pstates(const_sg_host_t host)
+ .. autodoxymethod:: sg_host_get_pstate(const_sg_host_t host)
+ .. autodoxymethod:: sg_host_get_pstate_speed(const_sg_host_t host, int pstate_index)
+ .. autodoxymethod:: sg_host_set_pstate(sg_host_t host, int pstate)
+
.. doxygenclass:: simgrid::s4u::Host
:members:
:protected-members:
Synchronization Objects
=======================
+.. _API_s4u_Mutex:
+
+==============
+ Mutex
+==============
+
+.. autodoxyclass:: simgrid::s4u::Mutex
+
+Basic management
+----------------
+
+ .. tabs::
+
+ .. group-tab:: C++
+
+ .. code-block:: C++
+
+ #include <simgrid/s4u/Mutex.hpp>
+
+ .. doxygentypedef:: MutexPtr
+
+ .. autodoxymethod:: simgrid::s4u::Mutex::Mutex(kernel::activity::MutexImpl *mutex)
+ .. autodoxymethod:: simgrid::s4u::Mutex::create()
+ .. autodoxymethod:: simgrid::s4u::Mutex::~Mutex()
+
+ .. group-tab:: C
+
+ .. code-block:: C
+
+ #include <simgrid/mutex.h>
+
+ .. doxygentypedef:: sg_mutex_t
+ .. cpp:type:: const s4u_Mutex* const_sg_mutex_t
+
+ Pointer to a constant mutex object.
+
+ .. autodoxymethod:: sg_mutex_init()
+ .. autodoxymethod:: sg_mutex_destroy(const_sg_mutex_t mutex)
+
+Locking
+-------
+
+ .. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Mutex::lock()
+ .. autodoxymethod:: simgrid::s4u::Mutex::try_lock()
+ .. autodoxymethod:: simgrid::s4u::Mutex::unlock()
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_mutex_lock(sg_mutex_t mutex)
+ .. autodoxymethod:: sg_mutex_try_lock(sg_mutex_t mutex)
+ .. autodoxymethod:: sg_mutex_unlock(sg_mutex_t mutex)
+
.. _API_s4u_Barrier:
================
- class Barrier
+ Barrier
================
-.. doxygentypedef:: BarrierPtr
-
.. autodoxyclass:: simgrid::s4u::Barrier
.. tabs::
.. group-tab:: C++
+ .. code-block:: C++
+
+ #include <simgrid/s4u/Barrier.hpp>
+
+ .. doxygentypedef:: BarrierPtr
+
.. autodoxymethod:: simgrid::s4u::Barrier::Barrier(unsigned int expected_actors)
.. autodoxymethod:: simgrid::s4u::Barrier::create(unsigned int expected_actors)
.. autodoxymethod:: simgrid::s4u::Barrier::wait()
+ .. group-tab:: C
+
+ .. code-block:: C
+
+ #include <simgrid/barrier.hpp>
+
+ .. doxygentypedef:: sg_bar_t
+ .. cpp:type:: const s4u_Barrier* const_sg_bar_t
+
+ Pointer to a constant barrier object.
+
+ .. autodoxymethod:: sg_barrier_init(unsigned int count)
+ .. autodoxymethod:: sg_barrier_destroy(const_sg_bar_t bar)
+ .. autodoxymethod:: sg_barrier_wait(sg_bar_t bar)
+
.. _API_s4u_ConditionVariable:
==========================
- class ConditionVariable
+ Condition variable
==========================
-.. doxygentypedef:: ConditionVariablePtr
+.. autodoxyclass:: simgrid::s4u::ConditionVariable
-.. doxygenclass:: simgrid::s4u::ConditionVariable
- :members:
- :protected-members:
- :undoc-members:
+Basic management
+----------------
-.. _API_s4u_Mutex:
+ .. tabs::
-==============
- class Mutex
-==============
+ .. group-tab:: C++
-.. doxygentypedef:: MutexPtr
+ .. code-block:: C++
-.. doxygenclass:: simgrid::s4u::Mutex
- :members:
- :protected-members:
- :undoc-members:
+ #include <simgrid/s4u/ConditionVariable.hpp>
+
+ .. doxygentypedef:: ConditionVariablePtr
+
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::create()
+
+ .. group-tab:: C
+
+ .. code-block:: C
+
+ #include <simgrid/cond.h>
+
+ .. doxygentypedef:: sg_cond_t
+ .. doxygenfunction:: sg_cond_init
+ .. doxygenfunction:: sg_cond_destroy
+
+Waiting and notifying
+---------------------
+
+ .. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::notify_all()
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::notify_one()
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(s4u::MutexPtr lock)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(const std::unique_lock< s4u::Mutex > &lock)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait(const std::unique_lock< Mutex > &lock, P pred)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, double duration)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, double duration, P pred)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, std::chrono::duration< Rep, Period > duration)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_for(const std::unique_lock< s4u::Mutex > &lock, std::chrono::duration< Rep, Period > duration, P pred)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, const SimulationTimePoint< Duration > &timeout_time)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, const SimulationTimePoint< Duration > &timeout_time, P pred)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, double timeout_time)
+ .. autodoxymethod:: simgrid::s4u::ConditionVariable::wait_until(const std::unique_lock< s4u::Mutex > &lock, double timeout_time, P pred)
+
+ .. group-tab:: C
+
+ .. doxygenfunction:: sg_cond_notify_all
+ .. doxygenfunction:: sg_cond_notify_one
+ .. doxygenfunction:: sg_cond_wait
+ .. doxygenfunction:: sg_cond_wait_for
.. _API_s4u_Semaphore:
==================
- class Semaphore
+ Semaphore
==================
-.. doxygentypedef:: SemaphorePtr
+.. autodoxyclass:: simgrid::s4u::Semaphore
-.. doxygenclass:: simgrid::s4u::Semaphore
- :members:
- :protected-members:
- :undoc-members:
+Basic management
+----------------
-C API Reference
-***************
+ .. tabs::
-==================
-Condition Variable
-==================
+ .. group-tab:: C++
-See also the :ref:`C++ API <API_s4u_ConditionVariable>`.
+ .. code-block:: C++
-.. doxygenfunction:: sg_cond_init
-.. doxygenfunction:: sg_cond_notify_all
-.. doxygenfunction:: sg_cond_notify_one
-.. doxygenfunction:: sg_cond_wait
-.. doxygenfunction:: sg_cond_wait_for
+ #include <simgrid/s4u/Semaphore.hpp>
-Python API Reference
-********************
+ .. doxygentypedef:: SemaphorePtr
+ .. autodoxymethod:: simgrid::s4u::Semaphore::Semaphore(unsigned int initial_capacity)
+ .. autodoxymethod:: simgrid::s4u::Semaphore::~Semaphore()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::create(unsigned int initial_capacity)
-The Python API is automatically generated with pybind11. It closely mimicks the C++
-API, to which you should refer for more information.
+ .. group-tab:: C
-==========
-this_actor
-==========
+ .. code-block:: C
-.. automodule:: simgrid.this_actor
- :members:
+ #include <simgrid/semaphore.h>
-===========
-Class Actor
-===========
+ .. doxygentypedef:: sg_sem_t
+ .. cpp:type:: const s4u_Semaphore* const_sg_sem_t
-.. autoclass:: simgrid.Actor
- :members:
+ Pointer to a constant semaphore object.
+
+ .. autodoxymethod:: sg_sem_init(int initial_value)
+ .. autodoxymethod:: sg_sem_destroy(const_sg_sem_t sem)
+
+Locking
+-------
+
+ .. tabs::
+
+ .. group-tab:: C++
+
+ .. autodoxymethod:: simgrid::s4u::Semaphore::acquire()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::acquire_timeout(double timeout)
+ .. autodoxymethod:: simgrid::s4u::Semaphore::get_capacity()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::release()
+ .. autodoxymethod:: simgrid::s4u::Semaphore::would_block()
+
+ .. group-tab:: C
+
+ .. autodoxymethod:: sg_sem_acquire(sg_sem_t sem)
+ .. autodoxymethod:: sg_sem_acquire_timeout(sg_sem_t sem, double timeout)
+ .. autodoxymethod:: sg_sem_get_capacity(sg_sem_t sem)
+ .. autodoxymethod:: sg_sem_release(sg_sem_t sem)
+ .. autodoxymethod:: sg_sem_would_block(sg_sem_t sem)
+
+Python API Reference
+********************
+
+The Python API is automatically generated with pybind11. It closely mimicks the C++
+API, to which you should refer for more information.
==========
Class Comm
.. autoclass:: simgrid.Comm
:members:
-============
-Class Engine
-============
-
-.. autoclass:: simgrid.Engine
- :members:
-
==========
Class Exec
==========
.. autoclass:: simgrid.Host
:members:
-=============
-Class Mailbox
-=============
-
-.. autoclass:: simgrid.Mailbox
- :members:
-
.. |hr| raw:: html
<hr />