default thread priority should be TP_low for readers and writers

This commit is contained in:
David Rose 2009-12-05 22:35:15 +00:00
parent e4305cf954
commit 2773e08b5a
4 changed files with 11 additions and 3 deletions

View File

@ -109,6 +109,11 @@ ConfigVariableInt net_max_write_per_epoch
"to minimize the impact of the networking layer on the other "
"threads."));
ConfigVariableEnum<ThreadPriority> net_thread_priority
("net-thread-priority", TP_low,
PRC_DESC("The default thread priority when creating threaded readers "
"or writers."));
////////////////////////////////////////////////////////////////////
// Function: init_libnet

View File

@ -19,6 +19,8 @@
#include "notifyCategoryProxy.h"
#include "configVariableInt.h"
#include "configVariableBool.h"
#include "configVariableEnum.h"
#include "threadPriority.h"
// Configure variables for net package.
@ -31,6 +33,7 @@ extern double get_max_poll_cycle();
extern ConfigVariableInt net_max_read_per_epoch;
extern ConfigVariableInt net_max_write_per_epoch;
extern ConfigVariableEnum<ThreadPriority> net_thread_priority;
extern EXPCL_PANDA_NET void init_libnet();

View File

@ -129,7 +129,7 @@ ConnectionReader(ConnectionManager *manager, int num_threads) :
_threads.push_back(thread);
}
for (i = 0; i < num_threads; i++) {
_threads[i]->start(TP_normal, true);
_threads[i]->start(net_thread_priority, true);
}
_manager->add_reader(this);
@ -849,7 +849,7 @@ thread_run(int thread_index) {
while (!_shutdown) {
SocketInfo *sinfo =
get_next_available_socket(false, thread_index);
get_next_available_socket(true, thread_index);
if (sinfo != (SocketInfo *)NULL) {
process_incoming_data(sinfo);
Thread::consider_yield();

View File

@ -81,7 +81,7 @@ ConnectionWriter(ConnectionManager *manager, int num_threads) :
_threads.push_back(thread);
}
for (i = 0; i < num_threads; i++) {
_threads[i]->start(TP_normal, true);
_threads[i]->start(net_thread_priority, true);
}
_manager->add_writer(this);