mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
ipc -> thread
This commit is contained in:
parent
581af369ef
commit
d1a921a9ab
@ -45,7 +45,7 @@
|
||||
pta_uchar.h referenceCount.I referenceCount.h \
|
||||
register_type.I register_type.h \
|
||||
reversedNumericData.I reversedNumericData.h \
|
||||
selectIpcImpl.h \
|
||||
selectThreadImpl.h \
|
||||
streamReader.I streamReader.h streamWriter.I streamWriter.h \
|
||||
subStream.I subStream.h subStreamBuf.h \
|
||||
threadDummyImpl.h threadDummyImpl.I thread.h thread.I threadImpl.h \
|
||||
@ -130,7 +130,7 @@
|
||||
profileTimer.h pta_uchar.h referenceCount.I referenceCount.h \
|
||||
register_type.I register_type.h \
|
||||
reversedNumericData.I reversedNumericData.h \
|
||||
selectIpcImpl.h \
|
||||
selectThreadImpl.h \
|
||||
streamReader.I streamReader.h streamWriter.I streamWriter.h \
|
||||
subStream.I subStream.h subStreamBuf.h \
|
||||
threadDummyImpl.h threadDummyImpl.I thread.h thread.I threadImpl.h \
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "atomicAdjustDummyImpl.h"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define ATOMICADJUSTDUMMYIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
#include "notify.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -40,6 +40,6 @@ public:
|
||||
|
||||
#include "atomicAdjustDummyImpl.I"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -20,14 +20,14 @@
|
||||
#define ATOMICADJUSTIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#if defined(IPC_DUMMY_IMPL)
|
||||
#if defined(THREAD_DUMMY_IMPL)
|
||||
|
||||
#include "atomicAdjustDummyImpl.h"
|
||||
typedef AtomicAdjustDummyImpl AtomicAdjustImpl;
|
||||
|
||||
#elif defined(IPC_NSPR_IMPL)
|
||||
#elif defined(THREAD_NSPR_IMPL)
|
||||
|
||||
#include "atomicAdjustNsprImpl.h"
|
||||
typedef AtomicAdjustNsprImpl AtomicAdjustImpl;
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "atomicAdjustNsprImpl.h"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define ATOMICADJUSTNSPRIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
|
||||
@ -41,6 +41,6 @@ public:
|
||||
|
||||
#include "atomicAdjustNsprImpl.I"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "conditionVarDummyImpl.h"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define CONDITIONVARDUMMYIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
|
||||
@ -46,6 +46,6 @@ public:
|
||||
|
||||
#include "conditionVarDummyImpl.I"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -20,14 +20,14 @@
|
||||
#define CONDITIONVARIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#if defined(IPC_DUMMY_IMPL)
|
||||
#if defined(THREAD_DUMMY_IMPL)
|
||||
|
||||
#include "conditionVarDummyImpl.h"
|
||||
typedef ConditionVarDummyImpl ConditionVarImpl;
|
||||
|
||||
#elif defined(IPC_NSPR_IMPL)
|
||||
#elif defined(THREAD_NSPR_IMPL)
|
||||
|
||||
#include "conditionVarNsprImpl.h"
|
||||
typedef ConditionVarNsprImpl ConditionVarImpl;
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "conditionVarNsprImpl.h"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define CONDITIONVARNSPRIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "mutexNsprImpl.h"
|
||||
#include "notify.h"
|
||||
@ -50,6 +50,6 @@ private:
|
||||
|
||||
#include "conditionVarNsprImpl.I"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
ConfigureDef(config_express);
|
||||
NotifyCategoryDef(express, "");
|
||||
NotifyCategoryDef(ipc, "");
|
||||
NotifyCategoryDef(thread, "");
|
||||
|
||||
extern void init_system_type_handles();
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
ConfigureDecl(config_express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
NotifyCategoryDecl(express, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
NotifyCategoryDecl(ipc, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
NotifyCategoryDecl(thread, EXPCL_PANDAEXPRESS, EXPTP_PANDAEXPRESS);
|
||||
|
||||
// Actually, we can't determine this config variable the normal way,
|
||||
// because we must be able to access it at static init time. Instead
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "mutexDummyImpl.h"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define MUTEXDUMMYIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
|
||||
@ -49,6 +49,6 @@ private:
|
||||
|
||||
#include "mutexDummyImpl.I"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MutexHolder::
|
||||
MutexHolder(Mutex &mutex) {
|
||||
#ifdef HAVE_IPC
|
||||
#ifdef HAVE_THREADS
|
||||
_mutex = &mutex;
|
||||
_mutex->lock();
|
||||
#endif
|
||||
@ -43,7 +43,7 @@ MutexHolder(Mutex &mutex) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MutexHolder::
|
||||
MutexHolder(Mutex *&mutex) {
|
||||
#ifdef HAVE_IPC
|
||||
#ifdef HAVE_THREADS
|
||||
if (mutex == (Mutex *)NULL) {
|
||||
mutex = new Mutex;
|
||||
}
|
||||
@ -59,7 +59,7 @@ MutexHolder(Mutex *&mutex) {
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE MutexHolder::
|
||||
~MutexHolder() {
|
||||
#ifdef HAVE_IPC
|
||||
#ifdef HAVE_THREADS
|
||||
_mutex->release();
|
||||
#endif
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
INLINE void operator = (const MutexHolder ©);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_IPC
|
||||
#ifdef HAVE_THREADS
|
||||
Mutex *_mutex;
|
||||
#endif
|
||||
};
|
||||
|
@ -20,14 +20,14 @@
|
||||
#define MUTEXIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#if defined(IPC_DUMMY_IMPL)
|
||||
#if defined(THREAD_DUMMY_IMPL)
|
||||
|
||||
#include "mutexDummyImpl.h"
|
||||
typedef MutexDummyImpl MutexImpl;
|
||||
|
||||
#elif defined(IPC_NSPR_IMPL)
|
||||
#elif defined(THREAD_NSPR_IMPL)
|
||||
|
||||
#include "mutexNsprImpl.h"
|
||||
typedef MutexNsprImpl MutexImpl;
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "mutexNsprImpl.h"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define MUTEXNSPRIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
|
||||
@ -47,6 +47,6 @@ private:
|
||||
|
||||
#include "mutexNsprImpl.I"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Filename: selectIpcImpl.h
|
||||
// Filename: selectThreadImpl.h
|
||||
// Created by: drose (09Aug02)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -16,32 +16,32 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SELECTIPCIMPL_H
|
||||
#define SELECTIPCIMPL_H
|
||||
#ifndef SELECTTHREADIMPL_H
|
||||
#define SELECTTHREADIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// This file decides which of the core implementations of the various
|
||||
// ipc (actually, threading) implementations we should use, based on
|
||||
// threading and locking implementations we should use, based on
|
||||
// platform and/or available libraries.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(HAVE_IPC)
|
||||
#if !defined(HAVE_THREADS)
|
||||
|
||||
// With IPC disabled, use the do-nothing implementation.
|
||||
#define IPC_DUMMY_IMPL 1
|
||||
// With threading disabled, use the do-nothing implementation.
|
||||
#define THREAD_DUMMY_IMPL 1
|
||||
|
||||
#elif defined(HAVE_NSPR)
|
||||
|
||||
// If NSPR is available, use that.
|
||||
#define IPC_NSPR_IMPL 1
|
||||
#define THREAD_NSPR_IMPL 1
|
||||
|
||||
#else
|
||||
|
||||
// This is a configuration error. For some reason, HAVE_IPC is
|
||||
// This is a configuration error. For some reason, HAVE_THREADS is
|
||||
// defined but we don't have any way to implement it.
|
||||
#error No ipc implementation defined for platform.
|
||||
#error No thread implementation defined for platform.
|
||||
|
||||
#endif
|
||||
|
@ -16,10 +16,10 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "threadDummyImpl.h"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define THREADDUMMYIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_DUMMY_IMPL
|
||||
#ifdef THREAD_DUMMY_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
#include "threadPriority.h"
|
||||
@ -59,6 +59,6 @@ public:
|
||||
|
||||
#include "threadDummyImpl.I"
|
||||
|
||||
#endif // IPC_DUMMY_IMPL
|
||||
#endif // THREAD_DUMMY_IMPL
|
||||
|
||||
#endif
|
||||
|
@ -20,14 +20,14 @@
|
||||
#define THREADIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#if defined(IPC_DUMMY_IMPL)
|
||||
#if defined(THREAD_DUMMY_IMPL)
|
||||
|
||||
#include "threadDummyImpl.h"
|
||||
typedef ThreadDummyImpl ThreadImpl;
|
||||
|
||||
#elif defined(IPC_NSPR_IMPL)
|
||||
#elif defined(THREAD_NSPR_IMPL)
|
||||
|
||||
#include "threadNsprImpl.h"
|
||||
typedef ThreadNsprImpl ThreadImpl;
|
||||
|
@ -17,9 +17,9 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "threadNsprImpl.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "pointerTo.h"
|
||||
#include "config_express.h"
|
||||
@ -35,8 +35,8 @@ bool ThreadNsprImpl::_got_pt_ptr_index = false;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
ThreadNsprImpl::
|
||||
~ThreadNsprImpl() {
|
||||
if (ipc_cat.is_debug()) {
|
||||
ipc_cat.debug() << "Deleting thread " << _parent_obj->get_name() << "\n";
|
||||
if (thread_cat.is_debug()) {
|
||||
thread_cat.debug() << "Deleting thread " << _parent_obj->get_name() << "\n";
|
||||
}
|
||||
|
||||
// If the thread object is destructing, it means the last pointer
|
||||
@ -70,7 +70,7 @@ ThreadNsprImpl::
|
||||
// make a thread unjoinable after it has been created, and a
|
||||
// thread can't join itself (can it?).
|
||||
if (_joinable) {
|
||||
ipc_cat.warning()
|
||||
thread_cat.warning()
|
||||
<< "thread " << _parent_obj->get_name() << " was never joined.\n";
|
||||
}
|
||||
return;
|
||||
@ -90,8 +90,8 @@ ThreadNsprImpl::
|
||||
bool ThreadNsprImpl::
|
||||
start(ThreadPriority priority, bool global, bool joinable) {
|
||||
MutexHolder holder(_mutex);
|
||||
if (ipc_cat.is_debug()) {
|
||||
ipc_cat.debug() << "Starting thread " << _parent_obj->get_name() << "\n";
|
||||
if (thread_cat.is_debug()) {
|
||||
thread_cat.debug() << "Starting thread " << _parent_obj->get_name() << "\n";
|
||||
}
|
||||
nassertr(_thread == (PRThread *)NULL, false);
|
||||
_joinable = joinable;
|
||||
@ -103,7 +103,7 @@ start(ThreadPriority priority, bool global, bool joinable) {
|
||||
if (result == PR_SUCCESS) {
|
||||
_got_pt_ptr_index = true;
|
||||
} else {
|
||||
ipc_cat.error()
|
||||
thread_cat.error()
|
||||
<< "Unable to associate Thread pointers with threads.\n";
|
||||
return false;
|
||||
}
|
||||
@ -181,8 +181,8 @@ root_func(void *data) {
|
||||
nassertv(result == PR_SUCCESS);
|
||||
parent_obj->thread_main();
|
||||
|
||||
if (ipc_cat.is_debug()) {
|
||||
ipc_cat.debug()
|
||||
if (thread_cat.is_debug()) {
|
||||
thread_cat.debug()
|
||||
<< "Terminating thread " << parent_obj->get_name()
|
||||
<< ", count = " << parent_obj->get_ref_count() << "\n";
|
||||
}
|
||||
@ -193,4 +193,4 @@ root_func(void *data) {
|
||||
unref_delete(parent_obj);
|
||||
}
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
@ -20,9 +20,9 @@
|
||||
#define THREADNSPRIMPL_H
|
||||
|
||||
#include "pandabase.h"
|
||||
#include "selectIpcImpl.h"
|
||||
#include "selectThreadImpl.h"
|
||||
|
||||
#ifdef IPC_NSPR_IMPL
|
||||
#ifdef THREAD_NSPR_IMPL
|
||||
|
||||
#include "notify.h"
|
||||
#include "threadPriority.h"
|
||||
@ -65,6 +65,6 @@ private:
|
||||
|
||||
#include "threadNsprImpl.I"
|
||||
|
||||
#endif // IPC_NSPR_IMPL
|
||||
#endif // THREAD_NSPR_IMPL
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user