Browse Source

better thread yielding

David Rose 16 years ago
parent
commit
4efc3ba42f
2 changed files with 9 additions and 0 deletions
  1. 3 0
      direct/src/plugin/Sources.pp
  2. 6 0
      direct/src/plugin/p3dPythonRun.cxx

+ 3 - 0
direct/src/plugin/Sources.pp

@@ -116,6 +116,9 @@
 
   #define WIN_SYS_LIBS user32.lib
 
+// hack
+  #define EXTRA_LIBS python2.4_panda
+
 #end bin_target
 
 #begin static_lib_target

+ 6 - 0
direct/src/plugin/p3dPythonRun.cxx

@@ -614,6 +614,12 @@ check_comm() {
     // closed.  We should exit gracefully.
     terminate_session();
   }
+
+  // Sleep to yield the timeslice, but only if we're not running in
+  // the main thread.
+  if (Thread::get_current_thread() != Thread::get_main_thread()) {
+    Thread::sleep(0.001);
+  }
 }
 
 ////////////////////////////////////////////////////////////////////