* More work on the threading stuff.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1113 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-12-14 21:18:51 +00:00
parent b635f8c852
commit 6a94909647
7 changed files with 101 additions and 8 deletions
+24 -3
View File
@@ -38,10 +38,17 @@
#include "thread_worker.h"
#include "globals.h"
#include "control.h"
#include <cassert>
#include <torrent/exceptions.h>
#include "core/manager.h"
ThreadWorker::ThreadWorker() {
m_taskTouchLog.set_slot(rak::mem_fn(this, &ThreadWorker::task_touch_log));
}
ThreadWorker::~ThreadWorker() {
}
@@ -53,8 +60,22 @@ ThreadWorker::init_thread() {
}
void
ThreadWorker::start_log_counter(ThreadBase* thread) {
assert(false);
ThreadWorker::start_log_counter(ThreadBase* baseThread) {
ThreadWorker* thread = (ThreadWorker*)baseThread;
throw torrent::internal_error("PRRREREREFFFERERE");
if (!thread->m_taskTouchLog.is_queued())
priority_queue_insert(&thread->m_taskScheduler, &thread->m_taskTouchLog, cachedTime);
}
void
ThreadWorker::task_touch_log() {
priority_queue_insert(&m_taskScheduler, &m_taskTouchLog, cachedTime + rak::timer::from_seconds(1));
acquire_global_lock();
__sync_synchronize();
control->core()->push_log("Tick Tock.");
__sync_synchronize();
release_global_lock();
}