use indirect notify dereferencers

This commit is contained in:
David Rose 2008-09-16 01:51:11 +00:00
parent 25af05eef3
commit a1856db611
8 changed files with 30 additions and 30 deletions

View File

@ -83,7 +83,7 @@ wait() {
return;
}
if (thread_cat.is_spam()) {
if (thread_cat->is_spam()) {
thread_cat.spam()
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
}
@ -129,7 +129,7 @@ signal() {
return;
}
if (thread_cat.is_spam()) {
if (thread_cat->is_spam()) {
thread_cat.spam()
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
}

View File

@ -83,7 +83,7 @@ wait() {
return;
}
if (thread_cat.is_spam()) {
if (thread_cat->is_spam()) {
thread_cat.spam()
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
}
@ -129,7 +129,7 @@ signal() {
return;
}
if (thread_cat.is_spam()) {
if (thread_cat->is_spam()) {
thread_cat.spam()
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
}
@ -164,7 +164,7 @@ signal_all() {
return;
}
if (thread_cat.is_spam()) {
if (thread_cat->is_spam()) {
thread_cat.spam()
<< *Thread::get_current_thread() << " signalling all " << *this << "\n";
}

View File

@ -128,7 +128,7 @@ do_lock() {
// Go to sleep on the condition variable until it's unlocked.
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< *this_thread << " blocking on " << *this << " (held by "
<< *_locking_thread << ")\n";
@ -202,7 +202,7 @@ do_debug_is_locked() const {
////////////////////////////////////////////////////////////////////
void MutexDebug::
report_deadlock(Thread *this_thread) {
thread_cat.error()
thread_cat->error()
<< "\n\n"
<< "****************************************************************\n"
<< "***** Deadlock detected! *****\n"

View File

@ -151,7 +151,7 @@ start(ThreadPriority priority, bool joinable) {
nassertr(!_started, false);
if (!support_threads) {
thread_cat.warning()
thread_cat->warning()
<< *this << " could not be started: support-threads is false.\n";
return false;
}
@ -159,7 +159,7 @@ start(ThreadPriority priority, bool joinable) {
_started = _impl.start(priority, joinable);
if (!_started) {
thread_cat.warning()
thread_cat->warning()
<< *this << " could not be started!\n";
}

View File

@ -32,7 +32,7 @@ bool ThreadPosixImpl::_got_pt_ptr_index = false;
////////////////////////////////////////////////////////////////////
ThreadPosixImpl::
~ThreadPosixImpl() {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Deleting thread " << _parent_obj->get_name() << "\n";
}
@ -67,7 +67,7 @@ setup_main_thread() {
bool ThreadPosixImpl::
start(ThreadPriority priority, bool joinable) {
_mutex.lock();
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
}
@ -94,7 +94,7 @@ start(ThreadPriority priority, bool joinable) {
int result = pthread_attr_setstacksize(&attr, thread_stack_size);
if (result != 0) {
thread_cat.warning()
thread_cat->warning()
<< "Unable to set stack size.\n";
}
@ -102,7 +102,7 @@ start(ThreadPriority priority, bool joinable) {
// run in parallel with other threads.
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
if (result != 0) {
thread_cat.warning()
thread_cat->warning()
<< "Unable to set system scope.\n";
}
@ -110,7 +110,7 @@ start(ThreadPriority priority, bool joinable) {
int current_policy = SCHED_OTHER;
result = pthread_attr_setschedpolicy(&attr, current_policy);
if (result != 0) {
thread_cat.warning()
thread_cat->warning()
<< "Unable to set scheduling policy.\n";
}
@ -134,7 +134,7 @@ start(ThreadPriority priority, bool joinable) {
}
if (result != 0) {
thread_cat.warning()
thread_cat->warning()
<< "Unable to specify thread priority.\n";
}
@ -220,7 +220,7 @@ root_func(void *data) {
self->_parent_obj->thread_main();
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Terminating thread " << self->_parent_obj->get_name()
<< ", count = " << self->_parent_obj->get_ref_count() << "\n";
@ -257,7 +257,7 @@ init_pt_ptr_index() {
int result = pthread_key_create(&_pt_ptr_index, NULL);
if (result != 0) {
thread_cat.error()
thread_cat->error()
<< "Unable to associate Thread pointers with threads.\n";
return;
}

View File

@ -55,7 +55,7 @@ ThreadSimpleImpl(Thread *parent_obj) :
////////////////////////////////////////////////////////////////////
ThreadSimpleImpl::
~ThreadSimpleImpl() {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Deleting thread " << _parent_obj->get_name() << "\n";
}
@ -88,7 +88,7 @@ setup_main_thread() {
////////////////////////////////////////////////////////////////////
bool ThreadSimpleImpl::
start(ThreadPriority priority, bool joinable) {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
}

View File

@ -77,7 +77,7 @@ enqueue_ready(ThreadSimpleImpl *thread) {
////////////////////////////////////////////////////////////////////
void ThreadSimpleManager::
enqueue_sleep(ThreadSimpleImpl *thread, double seconds) {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< *_current_thread->_parent_obj << " sleeping for "
<< seconds << " seconds\n";
@ -434,7 +434,7 @@ choose_next_context() {
// All threads are sleeping.
double wait = _sleeping.front()->_start_time - now;
if (wait > 0.0) {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Sleeping all threads " << wait << " seconds\n";
}
@ -446,7 +446,7 @@ choose_next_context() {
} else {
// No threads are ready!
if (!_blocked.empty()) {
thread_cat.error()
thread_cat->error()
<< "Deadlock! All threads blocked.\n";
report_deadlock();
abort();
@ -464,7 +464,7 @@ choose_next_context() {
// No threads are queued anywhere. This is some kind of
// internal error, since normally the main thread, at least,
// should be queued somewhere.
thread_cat.error()
thread_cat->error()
<< "All threads disappeared!\n";
exit(0);
}
@ -475,7 +475,7 @@ choose_next_context() {
_current_thread->_start_time = now;
// All right, the thread is ready to roll. Begin.
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
size_t blocked_count = 0;
Blocked::const_iterator bi;
for (bi = _blocked.begin(); bi != _blocked.end(); ++bi) {
@ -550,7 +550,7 @@ kill_non_joinable(ThreadSimpleManager::FifoThreads &threads) {
if (thread->_joinable) {
new_threads.push_back(thread);
} else {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Killing " << *thread->_parent_obj << "\n";
}
@ -577,7 +577,7 @@ kill_non_joinable(ThreadSimpleManager::Sleeping &threads) {
if (thread->_joinable) {
new_threads.push_back(thread);
} else {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Killing " << *thread->_parent_obj << "\n";
}

View File

@ -31,7 +31,7 @@ bool ThreadWin32Impl::_got_pt_ptr_index = false;
////////////////////////////////////////////////////////////////////
ThreadWin32Impl::
~ThreadWin32Impl() {
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug() << "Deleting thread " << _parent_obj->get_name() << "\n";
}
@ -58,7 +58,7 @@ setup_main_thread() {
bool ThreadWin32Impl::
start(ThreadPriority priority, bool joinable) {
_mutex.lock();
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
}
@ -175,7 +175,7 @@ root_func(LPVOID data) {
self->_parent_obj->thread_main();
if (thread_cat.is_debug()) {
if (thread_cat->is_debug()) {
thread_cat.debug()
<< "Terminating thread " << self->_parent_obj->get_name()
<< ", count = " << self->_parent_obj->get_ref_count() << "\n";
@ -213,7 +213,7 @@ init_pt_ptr_index() {
_pt_ptr_index = TlsAlloc();
if (_pt_ptr_index == TLS_OUT_OF_INDEXES) {
thread_cat.error()
thread_cat->error()
<< "Unable to associate Thread pointers with threads.\n";
return;
}