mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
use indirect notify dereferencers
This commit is contained in:
parent
25af05eef3
commit
a1856db611
@ -83,7 +83,7 @@ wait() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_cat.is_spam()) {
|
if (thread_cat->is_spam()) {
|
||||||
thread_cat.spam()
|
thread_cat.spam()
|
||||||
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
|
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ signal() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_cat.is_spam()) {
|
if (thread_cat->is_spam()) {
|
||||||
thread_cat.spam()
|
thread_cat.spam()
|
||||||
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
|
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ wait() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_cat.is_spam()) {
|
if (thread_cat->is_spam()) {
|
||||||
thread_cat.spam()
|
thread_cat.spam()
|
||||||
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
|
<< *Thread::get_current_thread() << " waiting on " << *this << "\n";
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ signal() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_cat.is_spam()) {
|
if (thread_cat->is_spam()) {
|
||||||
thread_cat.spam()
|
thread_cat.spam()
|
||||||
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
|
<< *Thread::get_current_thread() << " signalling " << *this << "\n";
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ signal_all() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread_cat.is_spam()) {
|
if (thread_cat->is_spam()) {
|
||||||
thread_cat.spam()
|
thread_cat.spam()
|
||||||
<< *Thread::get_current_thread() << " signalling all " << *this << "\n";
|
<< *Thread::get_current_thread() << " signalling all " << *this << "\n";
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ do_lock() {
|
|||||||
|
|
||||||
// Go to sleep on the condition variable until it's unlocked.
|
// Go to sleep on the condition variable until it's unlocked.
|
||||||
|
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< *this_thread << " blocking on " << *this << " (held by "
|
<< *this_thread << " blocking on " << *this << " (held by "
|
||||||
<< *_locking_thread << ")\n";
|
<< *_locking_thread << ")\n";
|
||||||
@ -202,7 +202,7 @@ do_debug_is_locked() const {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void MutexDebug::
|
void MutexDebug::
|
||||||
report_deadlock(Thread *this_thread) {
|
report_deadlock(Thread *this_thread) {
|
||||||
thread_cat.error()
|
thread_cat->error()
|
||||||
<< "\n\n"
|
<< "\n\n"
|
||||||
<< "****************************************************************\n"
|
<< "****************************************************************\n"
|
||||||
<< "***** Deadlock detected! *****\n"
|
<< "***** Deadlock detected! *****\n"
|
||||||
|
@ -151,7 +151,7 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
nassertr(!_started, false);
|
nassertr(!_started, false);
|
||||||
|
|
||||||
if (!support_threads) {
|
if (!support_threads) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< *this << " could not be started: support-threads is false.\n";
|
<< *this << " could not be started: support-threads is false.\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
_started = _impl.start(priority, joinable);
|
_started = _impl.start(priority, joinable);
|
||||||
|
|
||||||
if (!_started) {
|
if (!_started) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< *this << " could not be started!\n";
|
<< *this << " could not be started!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ bool ThreadPosixImpl::_got_pt_ptr_index = false;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ThreadPosixImpl::
|
ThreadPosixImpl::
|
||||||
~ThreadPosixImpl() {
|
~ThreadPosixImpl() {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Deleting thread " << _parent_obj->get_name() << "\n";
|
<< "Deleting thread " << _parent_obj->get_name() << "\n";
|
||||||
}
|
}
|
||||||
@ -67,7 +67,7 @@ setup_main_thread() {
|
|||||||
bool ThreadPosixImpl::
|
bool ThreadPosixImpl::
|
||||||
start(ThreadPriority priority, bool joinable) {
|
start(ThreadPriority priority, bool joinable) {
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
|
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);
|
int result = pthread_attr_setstacksize(&attr, thread_stack_size);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< "Unable to set stack size.\n";
|
<< "Unable to set stack size.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
// run in parallel with other threads.
|
// run in parallel with other threads.
|
||||||
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
result = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< "Unable to set system scope.\n";
|
<< "Unable to set system scope.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
int current_policy = SCHED_OTHER;
|
int current_policy = SCHED_OTHER;
|
||||||
result = pthread_attr_setschedpolicy(&attr, current_policy);
|
result = pthread_attr_setschedpolicy(&attr, current_policy);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< "Unable to set scheduling policy.\n";
|
<< "Unable to set scheduling policy.\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ start(ThreadPriority priority, bool joinable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
thread_cat.warning()
|
thread_cat->warning()
|
||||||
<< "Unable to specify thread priority.\n";
|
<< "Unable to specify thread priority.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ root_func(void *data) {
|
|||||||
|
|
||||||
self->_parent_obj->thread_main();
|
self->_parent_obj->thread_main();
|
||||||
|
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Terminating thread " << self->_parent_obj->get_name()
|
<< "Terminating thread " << self->_parent_obj->get_name()
|
||||||
<< ", count = " << self->_parent_obj->get_ref_count() << "\n";
|
<< ", 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);
|
int result = pthread_key_create(&_pt_ptr_index, NULL);
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
thread_cat.error()
|
thread_cat->error()
|
||||||
<< "Unable to associate Thread pointers with threads.\n";
|
<< "Unable to associate Thread pointers with threads.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ ThreadSimpleImpl(Thread *parent_obj) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ThreadSimpleImpl::
|
ThreadSimpleImpl::
|
||||||
~ThreadSimpleImpl() {
|
~ThreadSimpleImpl() {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Deleting thread " << _parent_obj->get_name() << "\n";
|
<< "Deleting thread " << _parent_obj->get_name() << "\n";
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ setup_main_thread() {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
bool ThreadSimpleImpl::
|
bool ThreadSimpleImpl::
|
||||||
start(ThreadPriority priority, bool joinable) {
|
start(ThreadPriority priority, bool joinable) {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
|
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ enqueue_ready(ThreadSimpleImpl *thread) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void ThreadSimpleManager::
|
void ThreadSimpleManager::
|
||||||
enqueue_sleep(ThreadSimpleImpl *thread, double seconds) {
|
enqueue_sleep(ThreadSimpleImpl *thread, double seconds) {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< *_current_thread->_parent_obj << " sleeping for "
|
<< *_current_thread->_parent_obj << " sleeping for "
|
||||||
<< seconds << " seconds\n";
|
<< seconds << " seconds\n";
|
||||||
@ -434,7 +434,7 @@ choose_next_context() {
|
|||||||
// All threads are sleeping.
|
// All threads are sleeping.
|
||||||
double wait = _sleeping.front()->_start_time - now;
|
double wait = _sleeping.front()->_start_time - now;
|
||||||
if (wait > 0.0) {
|
if (wait > 0.0) {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Sleeping all threads " << wait << " seconds\n";
|
<< "Sleeping all threads " << wait << " seconds\n";
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ choose_next_context() {
|
|||||||
} else {
|
} else {
|
||||||
// No threads are ready!
|
// No threads are ready!
|
||||||
if (!_blocked.empty()) {
|
if (!_blocked.empty()) {
|
||||||
thread_cat.error()
|
thread_cat->error()
|
||||||
<< "Deadlock! All threads blocked.\n";
|
<< "Deadlock! All threads blocked.\n";
|
||||||
report_deadlock();
|
report_deadlock();
|
||||||
abort();
|
abort();
|
||||||
@ -464,7 +464,7 @@ choose_next_context() {
|
|||||||
// No threads are queued anywhere. This is some kind of
|
// No threads are queued anywhere. This is some kind of
|
||||||
// internal error, since normally the main thread, at least,
|
// internal error, since normally the main thread, at least,
|
||||||
// should be queued somewhere.
|
// should be queued somewhere.
|
||||||
thread_cat.error()
|
thread_cat->error()
|
||||||
<< "All threads disappeared!\n";
|
<< "All threads disappeared!\n";
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ choose_next_context() {
|
|||||||
_current_thread->_start_time = now;
|
_current_thread->_start_time = now;
|
||||||
|
|
||||||
// All right, the thread is ready to roll. Begin.
|
// All right, the thread is ready to roll. Begin.
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
size_t blocked_count = 0;
|
size_t blocked_count = 0;
|
||||||
Blocked::const_iterator bi;
|
Blocked::const_iterator bi;
|
||||||
for (bi = _blocked.begin(); bi != _blocked.end(); ++bi) {
|
for (bi = _blocked.begin(); bi != _blocked.end(); ++bi) {
|
||||||
@ -550,7 +550,7 @@ kill_non_joinable(ThreadSimpleManager::FifoThreads &threads) {
|
|||||||
if (thread->_joinable) {
|
if (thread->_joinable) {
|
||||||
new_threads.push_back(thread);
|
new_threads.push_back(thread);
|
||||||
} else {
|
} else {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Killing " << *thread->_parent_obj << "\n";
|
<< "Killing " << *thread->_parent_obj << "\n";
|
||||||
}
|
}
|
||||||
@ -577,7 +577,7 @@ kill_non_joinable(ThreadSimpleManager::Sleeping &threads) {
|
|||||||
if (thread->_joinable) {
|
if (thread->_joinable) {
|
||||||
new_threads.push_back(thread);
|
new_threads.push_back(thread);
|
||||||
} else {
|
} else {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Killing " << *thread->_parent_obj << "\n";
|
<< "Killing " << *thread->_parent_obj << "\n";
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ bool ThreadWin32Impl::_got_pt_ptr_index = false;
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
ThreadWin32Impl::
|
ThreadWin32Impl::
|
||||||
~ThreadWin32Impl() {
|
~ThreadWin32Impl() {
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug() << "Deleting thread " << _parent_obj->get_name() << "\n";
|
thread_cat.debug() << "Deleting thread " << _parent_obj->get_name() << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ setup_main_thread() {
|
|||||||
bool ThreadWin32Impl::
|
bool ThreadWin32Impl::
|
||||||
start(ThreadPriority priority, bool joinable) {
|
start(ThreadPriority priority, bool joinable) {
|
||||||
_mutex.lock();
|
_mutex.lock();
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
|
thread_cat.debug() << "Starting " << *_parent_obj << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ root_func(LPVOID data) {
|
|||||||
|
|
||||||
self->_parent_obj->thread_main();
|
self->_parent_obj->thread_main();
|
||||||
|
|
||||||
if (thread_cat.is_debug()) {
|
if (thread_cat->is_debug()) {
|
||||||
thread_cat.debug()
|
thread_cat.debug()
|
||||||
<< "Terminating thread " << self->_parent_obj->get_name()
|
<< "Terminating thread " << self->_parent_obj->get_name()
|
||||||
<< ", count = " << self->_parent_obj->get_ref_count() << "\n";
|
<< ", count = " << self->_parent_obj->get_ref_count() << "\n";
|
||||||
@ -213,7 +213,7 @@ init_pt_ptr_index() {
|
|||||||
|
|
||||||
_pt_ptr_index = TlsAlloc();
|
_pt_ptr_index = TlsAlloc();
|
||||||
if (_pt_ptr_index == TLS_OUT_OF_INDEXES) {
|
if (_pt_ptr_index == TLS_OUT_OF_INDEXES) {
|
||||||
thread_cat.error()
|
thread_cat->error()
|
||||||
<< "Unable to associate Thread pointers with threads.\n";
|
<< "Unable to associate Thread pointers with threads.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user