From e5922ccd145227ed89edd8a831030d17d8121f96 Mon Sep 17 00:00:00 2001 From: stickz Date: Sun, 15 Sep 2024 13:25:23 -0400 Subject: [PATCH] Revert "libtorrent: Implement two hash queue threads (#28)" This reverts commit feb17f80d65139008a963c2ed9ed69484b463074. --- libtorrent/src/manager.cc | 7 ------- libtorrent/src/manager.h | 7 +------ libtorrent/src/torrent/torrent.cc | 3 --- 3 files changed, 1 insertion(+), 16 deletions(-) diff --git a/libtorrent/src/manager.cc b/libtorrent/src/manager.cc index ea6261438..a95af4152 100644 --- a/libtorrent/src/manager.cc +++ b/libtorrent/src/manager.cc @@ -87,13 +87,6 @@ Manager::Manager() : m_main_thread_main.signal_bitfield()->add_signal(std::bind(&HashQueue::work, m_hashQueue)), std::placeholders::_1); - m_hashQueueTwo = new HashQueue(&m_sub_thread_disk); - m_hashQueueTwo->slot_has_work() = - std::bind(&thread_base::send_event_signal, - &m_main_thread_main, - m_main_thread_main.signal_bitfield()->add_signal(std::bind(&HashQueue::work, m_hashQueueTwo)), - std::placeholders::_1); - m_taskTick.slot() = std::bind(&Manager::receive_tick, this); priority_queue_insert(&taskScheduler, &m_taskTick, cachedTime.round_seconds()); diff --git a/libtorrent/src/manager.h b/libtorrent/src/manager.h index 6f045f066..1db81e9be 100644 --- a/libtorrent/src/manager.h +++ b/libtorrent/src/manager.h @@ -72,7 +72,7 @@ class Manager { DownloadManager* download_manager() { return m_downloadManager; } FileManager* file_manager() { return m_fileManager; } HandshakeManager* handshake_manager() { return m_handshakeManager; } - HashQueue* hash_queue() { return ++m_hashQueueCount % 2 == 0 ? m_hashQueue : m_hashQueueTwo; } + HashQueue* hash_queue() { return m_hashQueue; } ResourceManager* resource_manager() { return m_resourceManager; } ChunkManager* chunk_manager() { return m_chunkManager; } @@ -84,7 +84,6 @@ class Manager { thread_main* main_thread_main() { return &m_main_thread_main; } thread_disk* main_thread_disk() { return &m_main_thread_disk; } - thread_disk* sub_thread_disk() { return &m_sub_thread_disk; } EncodingList* encoding_list() { return &m_encodingList; } @@ -101,7 +100,6 @@ class Manager { FileManager* m_fileManager; HandshakeManager* m_handshakeManager; HashQueue* m_hashQueue; - HashQueue* m_hashQueueTwo; ResourceManager* m_resourceManager; ChunkManager* m_chunkManager; @@ -111,15 +109,12 @@ class Manager { thread_main m_main_thread_main; thread_disk m_main_thread_disk; - thread_disk m_sub_thread_disk; EncodingList m_encodingList; Throttle* m_uploadThrottle; Throttle* m_downloadThrottle; - uint64_t m_hashQueueCount; - unsigned int m_ticks; rak::priority_item m_taskTick; }; diff --git a/libtorrent/src/torrent/torrent.cc b/libtorrent/src/torrent/torrent.cc index 62eda0da4..339c2c4f8 100644 --- a/libtorrent/src/torrent/torrent.cc +++ b/libtorrent/src/torrent/torrent.cc @@ -110,8 +110,6 @@ initialize() { manager->main_thread_disk()->init_thread(); manager->main_thread_disk()->start_thread(); - manager->sub_thread_disk()->init_thread(); - manager->sub_thread_disk()->start_thread(); } // Clean up and close stuff. Stopping all torrents and waiting for @@ -122,7 +120,6 @@ cleanup() { throw internal_error("torrent::cleanup() called but the library is not initialized."); manager->main_thread_disk()->stop_thread_wait(); - manager->sub_thread_disk()->stop_thread_wait(); delete manager; manager = NULL;