mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
prevent use of threading interfaces without HAVE_THREADS
This commit is contained in:
parent
5f3b0fc55b
commit
b19e098094
@ -81,6 +81,20 @@ ConnectionReader::
|
||||
ConnectionReader(ConnectionManager *manager, int num_threads) :
|
||||
_manager(manager)
|
||||
{
|
||||
#ifndef HAVE_THREADS
|
||||
// Although this code is written to use thread-locking primitives
|
||||
// regardless of the definition of HAVE_THREADS, it is not safe to
|
||||
// spawn multiple threads when HAVE_THREADS is not true, since we
|
||||
// might be using a non-thread-safe malloc scheme.
|
||||
#ifndef NDEBUG
|
||||
if (num_threads != 0) {
|
||||
net_cat.error()
|
||||
<< "Threading support is not available.\n";
|
||||
}
|
||||
#endif // NDEBUG
|
||||
num_threads = 0;
|
||||
#endif // HAVE_THREADS
|
||||
|
||||
_raw_mode = false;
|
||||
_tcp_header_size = datagram_tcp16_header_size;
|
||||
_polling = (num_threads <= 0);
|
||||
|
@ -38,6 +38,20 @@ ConnectionWriter::
|
||||
ConnectionWriter(ConnectionManager *manager, int num_threads) :
|
||||
_manager(manager)
|
||||
{
|
||||
#ifndef HAVE_THREADS
|
||||
// Although this code is written to use thread-locking primitives
|
||||
// regardless of the definition of HAVE_THREADS, it is not safe to
|
||||
// spawn multiple threads when HAVE_THREADS is not true, since we
|
||||
// might be using a non-thread-safe malloc scheme.
|
||||
#ifndef NDEBUG
|
||||
if (num_threads != 0) {
|
||||
net_cat.error()
|
||||
<< "Threading support is not available.\n";
|
||||
}
|
||||
#endif // NDEBUG
|
||||
num_threads = 0;
|
||||
#endif // HAVE_THREADS
|
||||
|
||||
_raw_mode = false;
|
||||
_tcp_header_size = datagram_tcp16_header_size;
|
||||
_immediate = (num_threads <= 0);
|
||||
|
@ -35,7 +35,11 @@
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PStatReader::
|
||||
PStatReader(PStatServer *manager, PStatMonitor *monitor) :
|
||||
#ifdef HAVE_THREADS
|
||||
ConnectionReader(manager, monitor->is_thread_safe() ? 1 : 0),
|
||||
#else // HAVE_THREADS
|
||||
ConnectionReader(manager, 0),
|
||||
#endif // HAVE_THREADS
|
||||
_manager(manager),
|
||||
_monitor(monitor),
|
||||
_writer(manager, 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user