Jelajahi Sumber

has_thread() etc.

David Rose 18 tahun lalu
induk
melakukan
30c30438d5

+ 15 - 0
panda/src/gobj/vertexDataPage.I

@@ -135,6 +135,21 @@ save_to_disk() {
   return do_save_to_disk();
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: VertexDataPage::has_thread
+//       Access: Published, Static
+//  Description: Returns true if a thread has been spawned to service
+//               vertex paging requests, or false if it has not (which
+//               may mean either that all paging requests will be
+//               handled by the main thread, or simply that no paging
+//               requests have yet been issued).
+////////////////////////////////////////////////////////////////////
+INLINE bool VertexDataPage::
+has_thread() {
+  MutexHolder holder(_tlock);
+  return !_thread.is_null();
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: VertexDataPage::get_page_data
 //       Access: Public

+ 4 - 0
panda/src/gobj/vertexDataPage.cxx

@@ -165,6 +165,8 @@ stop_thread() {
   }
 
   if (thread != (PageThread *)NULL) {
+    gobj_cat.info()
+      << "Stopping vertex paging thread.\n";
     thread->stop_thread();
   }
 }
@@ -512,6 +514,8 @@ request_ram_class(RamClass ram_class) {
   MutexHolder holder(_tlock);
   if (_thread == (PageThread *)NULL) {
     // Allocate and start a new global thread.
+    gobj_cat.info()
+      << "Spawning vertex paging thread.\n";
     _thread = new PageThread;
     _thread->start(TP_low, true);
   }

+ 2 - 0
panda/src/gobj/vertexDataPage.h

@@ -71,6 +71,8 @@ PUBLISHED:
   INLINE static VertexDataSaveFile *get_save_file();
 
   INLINE bool save_to_disk();
+
+  INLINE static bool has_thread();
   static void stop_thread();
 
 public: