has_thread() etc.

This commit is contained in:
David Rose 2007-06-07 03:33:49 +00:00
parent 99e4ecf5db
commit 30c30438d5
3 changed files with 21 additions and 0 deletions

View File

@ -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

View File

@ -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);
}

View File

@ -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: