zzj il y a 6 ans
Parent
commit
c1e7194f99
2 fichiers modifiés avec 6 ajouts et 5 suppressions
  1. 2 3
      card.cpp
  2. 4 2
      worker.cpp

+ 2 - 3
card.cpp

@@ -201,7 +201,7 @@ struct person:card_location_base,card_area
 	person(std::string type)
         :card_location_base(type)
 	{
-        m_message_handle .reset(new  card_message_handle(this));
+        m_message_handle.reset(new card_message_handle(this));
 	}
 
 	void on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history)
@@ -215,7 +215,7 @@ struct car:card_location_base,card_area
     car(std::string type)
         :card_location_base(type)
     {
-        m_message_handle .reset(new  card_message_handle(this));
+        m_message_handle.reset(new card_message_handle(this));
     }
 	void on_message(zloop<task*> * loop,const message_locinfo&loc,bool is_history)
 	{
@@ -249,4 +249,3 @@ void card_list::on_message(zloop<task*> *loop,const message_locinfo&loc,bool is_
 
 template<> std::shared_ptr<card_list> 
 single_base<card_list, int64_t, std::shared_ptr<card_location_base>>::m_instance=std::make_shared<card_list>();
-

+ 4 - 2
worker.cpp

@@ -120,8 +120,10 @@ struct worker_impl:worker
 worker_impl _worker_impl;
 worker*worker::instance()
 {
-	_worker_impl.init(1);
+	int num_thread=std::thread::hardware_concurrency();
+
+	log_info("worker thread count=%d",num_thread*2);
+	_worker_impl.init(num_thread<<1);
 	return &_worker_impl;
 }
 
-