aboutsummaryrefslogtreecommitdiff
path: root/libs/libtorrent/patches
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2019-09-09 15:00:42 -0700
committerRosen Penev <rosenp@gmail.com>2019-09-09 15:32:29 -0700
commite56fada5a860c12815af7235ed8500c7f446cac4 (patch)
tree2eddd91a3b383b95078b32096e0739cf7255b84c /libs/libtorrent/patches
parentad758ba286dd19e2004afb065e905461e4868e4a (diff)
libtorrent: Switch to static library.
libtorrent is only used by rtorrent. Switch to a static library to save space. Removed libsigc++ dependency. It seems it's not needed. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'libs/libtorrent/patches')
-rw-r--r--libs/libtorrent/patches/010-usleep.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/libs/libtorrent/patches/010-usleep.patch b/libs/libtorrent/patches/010-usleep.patch
new file mode 100644
index 000000000..6539fad1f
--- /dev/null
+++ b/libs/libtorrent/patches/010-usleep.patch
@@ -0,0 +1,54 @@
+--- a/src/data/hash_queue.cc
++++ b/src/data/hash_queue.cc
+@@ -38,9 +38,10 @@
+
+ #define __STDC_FORMAT_MACROS
+
++#include <chrono>
++#include <thread>
+ #include <functional>
+ #include <rak/functional.h>
+-#include <unistd.h>
+
+ #include "torrent/exceptions.h"
+ #include "torrent/data/download_data.h"
+@@ -137,7 +138,7 @@ HashQueue::remove(HashQueueNode::id_type id) {
+
+ while ((done_itr = m_done_chunks.find(hash_chunk)) == m_done_chunks.end()) {
+ pthread_mutex_unlock(&m_done_chunks_lock);
+- usleep(100);
++ std::this_thread::sleep_for(std::chrono::microseconds(100));
+ pthread_mutex_lock(&m_done_chunks_lock);
+ }
+
+--- a/src/torrent/utils/thread_base.cc
++++ b/src/torrent/utils/thread_base.cc
+@@ -37,8 +37,9 @@
+ #include "config.h"
+
+ #include <cstring>
++#include <chrono>
++#include <thread>
+ #include <signal.h>
+-#include <unistd.h>
+
+ #include "exceptions.h"
+ #include "poll.h"
+@@ -97,7 +98,7 @@ thread_base::stop_thread_wait() {
+ release_global_lock();
+
+ while (!is_inactive()) {
+- usleep(1000);
++ std::this_thread::sleep_for(std::chrono::milliseconds(1));
+ }
+
+ acquire_global_lock();
+@@ -161,7 +162,7 @@ thread_base::event_loop(thread_base* thread) {
+ }
+
+ // Add the sleep call when testing interrupts, etc.
+- // usleep(50);
++ // std::this_thread::sleep_for(std::chrono::microseconds(50));
+
+ int poll_flags = 0;
+