Skip to content

Commit

Permalink
Merge branch 'doc/jthread_limitation' into 'master'
Browse files Browse the repository at this point in the history
doc: Note down C++ std::jthread limitation

Closes IDF-6769 and IDFGH-9280

See merge request espressif/esp-idf!23570
  • Loading branch information
Zim Kalinowski committed May 9, 2023
2 parents 35bb946 + bb9912c commit 3010fd3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/en/api-guides/cplusplus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ esp-idf-cxx Component

`esp-idf-cxx <https://github.com/espressif/esp-idf-cxx>`_ component provides higher-level C++ APIs for some of the ESP-IDF features. This component is available from the `IDF Component Registry <https://components.espressif.com/components/espressif/esp-idf-cxx>`_.

.. _cplusplus_multithreading:

C++ language standard
---------------------

Expand All @@ -34,13 +32,19 @@ To compile the source code of a certain component using a different language sta
Use ``PUBLIC`` instead of ``PRIVATE`` if the public header files of the component also need to be compiled with the same language standard.

.. _cplusplus_multithreading:

Multithreading
--------------

C++ threads, mutexes, and condition variables are supported. C++ threads are built on top of pthreads, which in turn wrap FreeRTOS tasks.

See :example:`cxx/pthread` for an example of creating threads in C++.

.. note::

The destructor of `std::jthread <https://en.cppreference.com/w/cpp/thread/jthread>`_ can only safely be called from a task that has been created by :ref:`the IDF implementation of pthread_create() <posix_thread_api>` or by the `C++ threading library API <https://en.cppreference.com/w/cpp/thread>`_.

.. _cplusplus_exceptions:

Exception handling
Expand Down
2 changes: 2 additions & 0 deletions docs/en/api-reference/system/pthread.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The following standard APIs are implemented in ESP-IDF.

Refer to standard POSIX Threads documentation, or pthread.h, for details about the standard arguments and behaviour of each function. Differences or limitations compared to the standard APIs are noted below.

.. _posix_thread_api:

Thread APIs
^^^^^^^^^^^

Expand Down

0 comments on commit 3010fd3

Please sign in to comment.