mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 07:02:30 +00:00
* Fixed a potential issue causing high loads while waiting for main thread to exit polling. #2661
* Added 'strings.choke_heuristics.{upload,download}' and extra dummy upload/download heuristics for testings.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1263 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+10
-4
@@ -43,6 +43,7 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <rak/error_number.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
@@ -201,10 +202,15 @@ ThreadBase::queue_item(thread_base_func newFunc) {
|
||||
|
||||
void
|
||||
ThreadBase::interrupt_main_polling() {
|
||||
do {
|
||||
int sleep_length = 0;
|
||||
|
||||
while (ThreadBase::is_main_polling()) {
|
||||
pthread_kill(main_thread->m_thread, SIGUSR1);
|
||||
|
||||
if (!ThreadBase::is_main_polling())
|
||||
return;
|
||||
|
||||
pthread_kill(main_thread->m_thread, SIGUSR1);
|
||||
} while (1);
|
||||
|
||||
usleep(sleep_length);
|
||||
sleep_length = std::min(sleep_length + 50, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user