Add threading primitives.
PiperOrigin-RevId: 562649644 Change-Id: I9c35b270e4b3b50cc7eb5a152f24d71def8e2fcd
This commit is contained in:
committed by
Copybara-Service
parent
94a8705ad0
commit
6225186964
@@ -32,6 +32,7 @@ API function can be classified as:
|
||||
- :ref:`Derivatives<Derivatives-api>`.
|
||||
- :ref:`Plugin<Plugins-api>` related functions.
|
||||
- :ref:`Macros<Macros>`.
|
||||
- :ref:`Thread<Thread>` related functions.
|
||||
|
||||
.. TODO(b/273075045): Better category-label namespacing.
|
||||
|
||||
|
||||
@@ -712,7 +712,26 @@ Options for configuring the automatic :ref:`actuator length-range computation<CL
|
||||
|
||||
.. mujoco-include:: mjLROpt
|
||||
|
||||
.. _mjTask:
|
||||
|
||||
mjTask
|
||||
~~~~~~
|
||||
|
||||
This is a representation of a task to be run asynchronously inside of an :ref:`mjThreadPool` . It is created in the
|
||||
:ref:`mju_threadPoolEnqueue` method of the :ref:`mjThreadPool` and is used to join the task at completion.
|
||||
|
||||
.. mujoco-include:: mjTask
|
||||
|
||||
.. _mjThreadPool:
|
||||
|
||||
mjThreadPool
|
||||
~~~~~~~~~~~~
|
||||
|
||||
This is the data structure of the threadpool. It can only be constructed programmatically, and does not
|
||||
have an analog in MJCF. In order to enable multi-threaded calculations, a pointer to an existing :ref:`mjThreadPool`
|
||||
should be assigned to the ``mjData.threadpool``.
|
||||
|
||||
.. mujoco-include:: mjThreadPool
|
||||
|
||||
.. _tyStatStructure:
|
||||
|
||||
|
||||
@@ -3433,3 +3433,43 @@ mjp_getResourceProviderAtSlot
|
||||
Look up a resource provider by slot number returned by mjp_registerResourceProvider.
|
||||
If invalid slot number, return NULL.
|
||||
|
||||
.. _Thread:
|
||||
|
||||
Thread
|
||||
^^^^^^
|
||||
.. _mju_threadPoolCreate:
|
||||
|
||||
mju_threadPoolCreate
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_threadPoolCreate
|
||||
|
||||
Creates a thread pool with the specified number of threads running.
|
||||
|
||||
.. _mju_threadPoolEnqueue:
|
||||
|
||||
mju_threadPoolEnqueue
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_threadPoolEnqueue
|
||||
|
||||
Enqueues a task in a thread pool.
|
||||
|
||||
.. _mju_taskJoin:
|
||||
|
||||
mju_taskJoin
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_taskJoin
|
||||
|
||||
Waits for a task to complete.
|
||||
|
||||
.. _mju_threadPoolDestroy:
|
||||
|
||||
mju_threadPoolDestroy
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. mujoco-include:: mju_threadPoolDestroy
|
||||
|
||||
Destroys a thread pool.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user