00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "config_pipeline.h"
00016 #include "asyncTaskBase.h"
00017 #include "mainThread.h"
00018 #include "externalThread.h"
00019 #include "genericThread.h"
00020 #include "thread.h"
00021 #include "pythonThread.h"
00022 #include "pandaSystem.h"
00023
00024 #include "dconfig.h"
00025
00026 ConfigureDef(config_pipeline);
00027 NotifyCategoryDef(pipeline, "");
00028 NotifyCategoryDef(thread, "");
00029
00030 ConfigureFn(config_pipeline) {
00031 init_libpipeline();
00032 }
00033
00034 ConfigVariableBool support_threads
00035 ("support-threads", true,
00036 PRC_DESC("Set this false to disallow the creation of threads using Panda's "
00037 "Thread interface, even if threading support is compiled in. This "
00038 "does not affect the operation of mutexes and other synchronization "
00039 "primitives, just the creation of threads."));
00040
00041 ConfigVariableBool name_deleted_mutexes
00042 ("name-deleted-mutexes", false,
00043 PRC_DESC("Set this true to allocate a name to each Mutex object that "
00044 "destructs, so if the Mutex is locked after destruction, we can "
00045 "print out its name to aid debugging. This is only available "
00046 "when compiled with DEBUG_THREADS. Enabling this variable will "
00047 "cause a memory leak, so you should only enable it when you are "
00048 "specifically tracking down an operation on a deleted Mutex. "
00049 "It is not guaranteed to work, of course, because the memory "
00050 "for a deleted Mutex may become reused for some other purpose."));
00051
00052 ConfigVariableInt thread_stack_size
00053 ("thread-stack-size", 4194304,
00054 PRC_DESC("Specifies the minimum size, in bytes, of the stack that will be "
00055 "created for each newly-created thread. Not all thread "
00056 "implementations respect this value."));
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 void
00067 init_libpipeline() {
00068 static bool initialized = false;
00069 if (initialized) {
00070 return;
00071 }
00072 initialized = true;
00073
00074 AsyncTaskBase::init_type();
00075 MainThread::init_type();
00076 ExternalThread::init_type();
00077 GenericThread::init_type();
00078 Thread::init_type();
00079 #ifdef HAVE_PYTHON
00080 PythonThread::init_type();
00081 #endif // HAVE_PYTHON
00082
00083 #ifdef HAVE_THREADS
00084 {
00085 PandaSystem *ps = PandaSystem::get_global_ptr();
00086 ps->add_system("threads");
00087 }
00088 #endif // HAVE_THREADS
00089 }