瀏覽代碼

more threading fixes

David Rose 20 年之前
父節點
當前提交
92b907eb07

+ 5 - 5
panda/src/display/graphicsEngine.cxx

@@ -1219,9 +1219,10 @@ do_add_window(GraphicsOutput *window, GraphicsStateGuardian *gsg,
   // now, we assume this is the app thread.
   // now, we assume this is the app thread.
   _app.add_window(_app._window, window);
   _app.add_window(_app._window, window);
   
   
-  // This was info(), but that is spammy now with the ParisiteBuffer.
-  display_cat.debug()
-    << "Created " << window->get_type() << " " << (void *)window << "\n";
+  if (display_cat.is_debug()) {
+    display_cat.debug()
+      << "Created " << window->get_type() << " " << (void *)window << "\n";
+  }
   
   
   // By default, try to open each window as it is added.
   // By default, try to open each window as it is added.
   window->request_open();
   window->request_open();
@@ -1755,7 +1756,6 @@ void GraphicsEngine::RenderThread::
 thread_main() {
 thread_main() {
   MutexHolder holder(_cv_mutex);
   MutexHolder holder(_cv_mutex);
   while (true) {
   while (true) {
-    _cv.wait();
     switch (_thread_state) {
     switch (_thread_state) {
     case TS_wait:
     case TS_wait:
       break;
       break;
@@ -1780,7 +1780,6 @@ thread_main() {
     case TS_do_windows:
     case TS_do_windows:
       do_windows(_engine);
       do_windows(_engine);
       do_pending(_engine);
       do_pending(_engine);
-      do_release(_engine);
       _thread_state = TS_wait;
       _thread_state = TS_wait;
       break;
       break;
 
 
@@ -1789,5 +1788,6 @@ thread_main() {
       do_close(_engine);
       do_close(_engine);
       return;
       return;
     }
     }
+    _cv.wait();
   }
   }
 }
 }

+ 1 - 0
panda/src/display/graphicsOutput.cxx

@@ -1259,6 +1259,7 @@ make_current() {
 void GraphicsOutput::
 void GraphicsOutput::
 release_gsg() {
 release_gsg() {
   _gsg.clear();
   _gsg.clear();
+  _active = false;
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 4 - 0
panda/src/express/mainThread.h

@@ -42,6 +42,10 @@ public:
     register_type(_type_handle, "MainThread",
     register_type(_type_handle, "MainThread",
                   Thread::get_class_type());
                   Thread::get_class_type());
   }
   }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
 
 
 private:
 private:
   static TypeHandle _type_handle;
   static TypeHandle _type_handle;

+ 4 - 0
panda/src/express/thread.h

@@ -83,6 +83,10 @@ public:
     register_type(_type_handle, "Thread",
     register_type(_type_handle, "Thread",
                   TypedReferenceCount::get_class_type());
                   TypedReferenceCount::get_class_type());
   }
   }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
 
 
 private:
 private:
   static TypeHandle _type_handle;
   static TypeHandle _type_handle;