title: boost.python not supporting parallelism?
body: <p>I am trying to wrap a piece of C++ code into python lib using boost.python, however, I found out that multiple instances cannot run at the same time:</p>
  
  <p>code (C++):</p>
  
  <pre class="lang-cpp prettyprint-override"><code>class Foo{
  public:
      Foo(){}
      void run(){
          int seconds = 2;
          clock_t endwait;
          endwait = clock () + seconds * CLOCKS_PER_SEC ;
          while (clock() &lt; endwait) {}
      }   
  
  };
  
  BOOST_PYTHON_MODULE(run_test)
  {
     using namespace boost::python;
  
     class_&lt;Foo&gt;("test", init&lt;&gt;())
        .def("run", &amp;Foo::run)
        ;   
  
  }
  </code></pre>
  
  <p>which is compile using CMake (CMake):</p>
  
  <pre class="lang-none prettyprint-override"><code>add_library(run_test SHARED run_test.cpp)
  target_link_libraries(run_test boost_python python2.7)
  </code></pre>
  
  <p>and tested with the following code (Python):</p>
  
  <pre class="lang-py prettyprint-override"><code>class Dos(threading.Thread):
      def run(self):
          printl('performing DoS attack')
  
          proc = test()
          proc.run()
  
  for i in range(5):
      t = Dos()
      t.start()
  </code></pre>
  
  <p>The output indicates that the code is parallelized in a very weird way. Each thread should take only 2 seconds and 4 threads should run simultaneously on my quadcore machine:</p>
  
  <pre class="lang-none prettyprint-override"><code>[2011-11-04 13:57:01] performing DoS attack
   [2011-11-04 13:57:01] performing DoS attack
  [2011-11-04 13:57:05] performing DoS attack
   [2011-11-04 13:57:05] performing DoS attack
  [2011-11-04 13:57:09] performing DoS attack
  </code></pre>
  
  <p>thank you for your help!</p>