mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 04:32:30 +00:00
* 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:
+24
-3
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user