From bb9912cc57c1dc317f11914af0d775f7b7ec40f2 Mon Sep 17 00:00:00 2001 From: Jakob Hasse Date: Thu, 4 May 2023 17:26:40 +0800 Subject: [PATCH] doc: Added C++ std::jthread limitation --- docs/en/api-guides/cplusplus.rst | 8 ++++++-- docs/en/api-reference/system/pthread.rst | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/en/api-guides/cplusplus.rst b/docs/en/api-guides/cplusplus.rst index c188c467b1..71a5bba6b9 100644 --- a/docs/en/api-guides/cplusplus.rst +++ b/docs/en/api-guides/cplusplus.rst @@ -18,8 +18,6 @@ esp-idf-cxx Component `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 `_. -.. _cplusplus_multithreading: - C++ language standard --------------------- @@ -34,6 +32,8 @@ 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 -------------- @@ -41,6 +41,10 @@ C++ threads, mutexes, and condition variables are supported. C++ threads are bui See :example:`cxx/pthread` for an example of creating threads in C++. +.. note:: + + The destructor of `std::jthread `_ can only safely be called from a task that has been created by :ref:`the IDF implementation of pthread_create() ` or by the `C++ threading library API `_. + .. _cplusplus_exceptions: Exception handling diff --git a/docs/en/api-reference/system/pthread.rst b/docs/en/api-reference/system/pthread.rst index 3601c7c72c..ea81e20c69 100644 --- a/docs/en/api-reference/system/pthread.rst +++ b/docs/en/api-reference/system/pthread.rst @@ -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 ^^^^^^^^^^^