* Finished the foundation of threading.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1114 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-12-15 21:39:35 +00:00
parent 6a94909647
commit 2304983f4f
6 changed files with 15 additions and 53 deletions
+6 -1
View File
@@ -44,6 +44,7 @@
#include <torrent/torrent.h>
#include "poll_manager_epoll.h"
#include "thread_base.h"
namespace core {
@@ -67,7 +68,11 @@ PollManagerEPoll::poll(rak::timer timeout) {
torrent::perform();
timeout = std::min(timeout, rak::timer(torrent::next_timeout())) + 1000;
if (static_cast<torrent::PollEPoll*>(m_poll)->poll((timeout.usec() + 999) / 1000) == -1)
ThreadBase::release_global_lock();
int status = static_cast<torrent::PollEPoll*>(m_poll)->poll((timeout.usec() + 999) / 1000);
ThreadBase::acquire_global_lock();
if (status == -1)
return check_error();
torrent::perform();
+6 -1
View File
@@ -45,6 +45,7 @@
#include <torrent/torrent.h>
#include "poll_manager_kqueue.h"
#include "thread_base.h"
namespace core {
@@ -68,7 +69,11 @@ PollManagerKQueue::poll(rak::timer timeout) {
torrent::perform();
timeout = std::min(timeout, rak::timer(torrent::next_timeout())) + 1000;
if (static_cast<torrent::PollKQueue*>(m_poll)->poll((timeout.usec() + 999) / 1000) == -1)
ThreadBase::release_global_lock();
int status = static_cast<torrent::PollKQueue*>(m_poll)->poll((timeout.usec() + 999) / 1000);
ThreadBase::acquire_global_lock();
if (status == -1)
return check_error();
torrent::perform();
+1 -1
View File
@@ -95,7 +95,7 @@ PollManagerSelect::poll(rak::timer timeout) {
ThreadBase::release_global_lock();
int status = select(maxFd + 1, m_readSet, m_writeSet, m_errorSet, &t);
ThreadBase::release_global_lock();
ThreadBase::acquire_global_lock();
if (status == -1)
return check_error();