Add notes about standard threading classes to the documentation

There is no reason to use wxMutex and wxCondition in C++11 programs as
they have about the same API as the corresponding standard classes but
are, well, non-standard.

wxThread API is different from std::thread, so it's a less obvious
replacement, but still at least mention the standard class in its
documentation.
This commit is contained in:
Vadim Zeitlin
2020-06-01 15:10:24 +02:00
parent 192e8befb8
commit 66c8437952

View File

@@ -23,6 +23,8 @@ enum wxCondError
They may be used in a multithreaded application to wait until the given condition
becomes @true which happens when the condition becomes signaled.
@note In C++11 programs, prefer using @c std::condition to this class.
For example, if a worker thread is doing some long task and another thread has
to wait until it is finished, the latter thread will wait on the condition
object and the worker thread will signal it on exit (this example is not
@@ -720,6 +722,8 @@ enum wxThreadError
between threads and processes is that memory spaces of different processes are
separated while all threads share the same address space.
@note In C++11 programs, consider using @c std::thread instead of this class.
While it makes it much easier to share common data between several threads, it
also makes it much easier to shoot oneself in the foot, so careful use of
synchronization objects such as mutexes (see wxMutex) or critical sections
@@ -1569,6 +1573,8 @@ enum wxMutexError
from its usefulness in coordinating mutually-exclusive access to a shared
resource as only one thread at a time can own a mutex object.
@note In C++11 programs, prefer using @c std::mutex to this class.
Mutexes may be recursive in the sense that a thread can lock a mutex which it
had already locked before (instead of dead locking the entire process in this
situation by starting to wait on a mutex which will never be released while the