ソースを参照

default thread priority should be TP_low for readers and writers

David Rose 16 年 前
コミット
2773e08b5a

+ 5 - 0
panda/src/net/config_net.cxx

@@ -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

+ 3 - 0
panda/src/net/config_net.h

@@ -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();
 

+ 2 - 2
panda/src/net/connectionReader.cxx

@@ -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();

+ 1 - 1
panda/src/net/connectionWriter.cxx

@@ -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);