mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-08 19:22:29 +00:00
* Allow interrupting a thread's polling through SIGUSR1. Used to signal events across threads.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1121 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+4
-4
@@ -42,6 +42,8 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
#include <rak/error_number.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "globals.h"
|
||||
@@ -135,7 +137,7 @@ ThreadBase::stop_thread(ThreadBase* thread) {
|
||||
inline rak::timer
|
||||
ThreadBase::client_next_timeout() {
|
||||
if (m_taskScheduler.empty())
|
||||
return rak::timer::from_seconds(2);
|
||||
return rak::timer::from_seconds(600);
|
||||
else if (m_taskScheduler.top()->time() <= cachedTime)
|
||||
return 0;
|
||||
else
|
||||
@@ -189,7 +191,5 @@ ThreadBase::call_queued_items() {
|
||||
void
|
||||
ThreadBase::queue_item(thread_base_func newFunc) {
|
||||
m_threadQueue->push_back(newFunc);
|
||||
|
||||
// TODO: Need to send a signal that interrupts polling so as to
|
||||
// ensure we react immediately.
|
||||
pthread_kill(m_thread, SIGUSR1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user