Skip to content

Commit 70d508f

Browse files
committed
Expand comment for new interkeeper() function
1 parent b6f58a5 commit 70d508f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

matplotlibcpp.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy