I got very strange behavior of my python extension built with the boost.python library. Namely, in the piece of code:
import my_ext
j = 0
while j<5:
print j
my_ext.do_something(j)
j = j + 1
i do not see j being printed out, while the extension code (my_ext.do_something(j)
) is doing some work for different j (lets say prints j-th file). Moreover it only prints 2 files for j = 0 and j = 1 and then the whole script finishes without errors or other notifications.
All this makes me think the code is executed kinda in parallel (multi-threading), but without proper handling of such a parallelizm. I guess this may be related to the fact that the boost.python library i have built is made by default with --threading=multi option. However, trying to rebuild with option --threading=single does not give any effect and it is still built as multi-threading library. This post http://mail.python.org/pipermail/cplusplus-sig/2010-October/015771.html reports similar build process problem, however it is unanswered.
So my question is how to build boost libraries and boost.python in particular to be single-threaded. Alternatively, the problem may be related to something other than single/multi threading of boost.python libraries.
Additional info: i'm using cygwin, boost_1.50.0, python2.6, my os is Win 7 with multi-core CPU and nvidia vram (both latter harware may favor multi-threading execution of my extension without letting me know).