mirror of https://github.com/swig/swig
Director thread-safety doc tweaks
This commit is contained in:
parent
3dfd65e1cd
commit
46b7bafb21
|
@ -15,7 +15,8 @@ Version 4.3.0 (in progress)
|
|||
2024-07-02: erezgeva
|
||||
[Python, Ruby] #2870 Change the thread safety options for the director code
|
||||
that manages C++ director pointer ownership. Please define SWIG_THREADS to
|
||||
turn on thread safety. Implementation now includes a C++11 std::mutex option
|
||||
turn on thread safety. For Python, this can also be done via the threads
|
||||
module option or -threads. Implementation now includes a C++11 std::mutex option
|
||||
as priority over WIN32 and pthread mutexes. See director_guard.swg for further
|
||||
implementation details.
|
||||
|
||||
|
|
|
@ -3281,8 +3281,9 @@ need to be supported.
|
|||
<p>
|
||||
The director implementation uses a <tt>std::map</tt> to manage C++ pointer ownership.
|
||||
This code is not thread-safe by default.
|
||||
Adding the <tt>SWIG_THREADS</tt> macro when compiling the C++ code will use a mutex
|
||||
for managing the pointer ownership to make the implementation thread-safe.
|
||||
See <a href="Python.hthml#Python_multithreaded">Thread safety</a> for turning on thread-safety.
|
||||
This defines a macro called <tt>SWIG_THREADS</tt> which forces the C++ code to then use a mutex
|
||||
for managing the pointer ownership, which in turn makes the directors implementation thread-safe.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -7428,7 +7429,7 @@ will not be able to run any other threads, even if the wrapped C/C++ code is wai
|
|||
<p>
|
||||
The <tt>threads</tt> module option in the *.i template file:
|
||||
</p>
|
||||
<div class="code"><pre>%module("threads"=1)</pre></div>
|
||||
<div class="code"><pre>%module(threads="1")</pre></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
%module(directors="1", threads) director_guard;
|
||||
%module(directors="1", threads="1") director_guard;
|
||||
|
||||
%feature("director") Callback;
|
||||
|
||||
|
|
Loading…
Reference in New Issue