* More work on threading.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1112 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-12-12 21:30:52 +00:00
parent ef6e4deca9
commit b635f8c852
15 changed files with 278 additions and 48 deletions
+4 -12
View File
@@ -80,7 +80,7 @@ public:
iterator itr = begin();
lock();
while (*itr != NULL) *++dest = *++itr;
while (*itr != NULL) *dest++ = *itr++;
clear_and_unlock();
return dest;
@@ -111,14 +111,6 @@ ThreadBase::~ThreadBase() {
// Cleanup...
}
// Main thread init... Always replace this.
void
ThreadBase::init_thread() {
this_thread = this;
m_pollManager = core::PollManager::create_poll_manager();
}
void
ThreadBase::start_thread() {
if (m_state != STATE_INITIALIZED ||
@@ -144,7 +136,7 @@ ThreadBase::event_loop(ThreadBase* threadBase) {
// // Remember to add global lock thing to the main poll loop ++.
// rak::priority_queue_perform(&threadBase->m_taskScheduler, cachedTime);
rak::priority_queue_perform(&threadBase->m_taskScheduler, cachedTime);
threadBase->m_pollManager->poll_simple(rak::timer::from_seconds(10));
}
@@ -158,8 +150,8 @@ ThreadBase::call_queued_items() {
thread_base_func* first = result;
thread_base_func* last = m_threadQueue->copy_and_clear((thread_base_func*)result);
while (first != last)
(*first)(this);
while (first != last && *first)
(*first++)(this);
}
void