File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,14 @@ struct _interpreter {
103103
104104 /* For now, _interpreter is implemented as a singleton since its currently not possible to have
105105 multiple independent embedded python interpreters without patching the python source code
106- or starting a separate process for each.
107- http://bytes.com/topic/python/answers/793370-multiple-independent-python-interpreters-c-c-program
106+ or starting a separate process for each. [1]
107+ Furthermore, many python objects expect that they are destructed in the same thread as they
108+ were constructed. [2] So for advanced usage, a `kill()` function is provided so that library
109+ users can manually ensure that the interpreter is constructed and destroyed within the
110+ same thread.
111+
112+ 1: http://bytes.com/topic/python/answers/793370-multiple-independent-python-interpreters-c-c-program
113+ 2: https://github.com/lava/matplotlib-cpp/pull/202#issue-436220256
108114 */
109115
110116 static _interpreter& get () {
@@ -115,6 +121,7 @@ struct _interpreter {
115121 return interkeeper (true );
116122 }
117123
124+ // Stores the actual singleton object referenced by `get()` and `kill()`.
118125 static _interpreter& interkeeper (bool should_kill) {
119126 static _interpreter ctx;
120127 if (should_kill)
You can’t perform that action at this time.
0 commit comments