• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Is Boost.Python thread-aware/compatible with multiple interpreters?</title>
5<link rel="stylesheet" href="../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../index.html" title="Boost.Python">
8<link rel="up" href="../faq.html" title="Chapter 5. Frequently Asked Questions (FAQs)">
9<link rel="prev" href="why_is_my_automatic_to_python_co.html" title="Why is my automatic to-python conversion not being found?">
10<link rel="next" href="../glossary.html" title="Chapter 6. Glossary">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../images/boost.png"></td></tr></table>
14<hr>
15<div class="spirit-nav">
16<a accesskey="p" href="why_is_my_automatic_to_python_co.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../glossary.html"><img src="../images/next.png" alt="Next"></a>
17</div>
18<div class="section">
19<div class="titlepage"><div><div><h3 class="title">
20<a name="faq.is_boost_python_thread_aware_com"></a><a class="link" href="is_boost_python_thread_aware_com.html" title="Is Boost.Python thread-aware/compatible with multiple interpreters?">Is Boost.Python
21      thread-aware/compatible with multiple interpreters?</a>
22</h3></div></div></div>
23<p>
24        <span class="emphasis"><em>Niall Douglas provides these notes:</em></span>
25      </p>
26<p>
27        The quick answer to this is: no.
28      </p>
29<p>
30        The longer answer is that it can be patched to be so, but it's complex. You
31        will need to add custom lock/unlock wrapping of every time your code enters
32        Boost.Python (particularly every virtual function override) plus heavily
33        modify <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">python</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">invoke</span><span class="special">.</span><span class="identifier">hpp</span></code> with custom unlock/lock wrapping of
34        every time Boost.Python enters your code. You must furthermore take care
35        to <span class="emphasis"><em>not</em></span> unlock/lock when Boost.Python is invoking iterator
36        changes via <code class="computeroutput"><span class="identifier">invoke</span><span class="special">.</span><span class="identifier">hpp</span></code>.
37      </p>
38<p>
39        There is a patched <code class="computeroutput"><span class="identifier">invoke</span><span class="special">.</span><span class="identifier">hpp</span></code> posted
40        on the C++-SIG mailing list archives and you can find a real implementation
41        of all the machinery necessary to fully implement this in the TnFOX project
42        at <a href="http://sourceforge.net/projects/tnfox/" target="_top">this</a> SourceForge
43        project location.
44      </p>
45</div>
46<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
47<td align="left"></td>
48<td align="right"><div class="copyright-footer">Copyright © 2002-2015 David
49      Abrahams, Stefan Seefeld<p>
50        Distributed under the Boost Software License, Version 1.0. (See accompanying
51        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
52      </p>
53</div></td>
54</tr></table>
55<hr>
56<div class="spirit-nav">
57<a accesskey="p" href="why_is_my_automatic_to_python_co.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../faq.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="../glossary.html"><img src="../images/next.png" alt="Next"></a>
58</div>
59</body>
60</html>
61