aboutsummaryrefslogtreecommitdiff
path: root/net/rtorrent/patches
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2019-09-09 15:16:08 -0700
committerRosen Penev <rosenp@gmail.com>2019-09-09 15:32:29 -0700
commit358495f1184d005624f7e15fc9990bde1bb7552e (patch)
treee78cee1d1778170d4174b075e9ef78a7b57c4607 /net/rtorrent/patches
parente56fada5a860c12815af7235ed8500c7f446cac4 (diff)
rtorrent: Switch to using static libtorrent
rtorrent is the only user of libtorrent. Statically link to save space. Added usleep patch. Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'net/rtorrent/patches')
-rw-r--r--net/rtorrent/patches/130-usleep.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/net/rtorrent/patches/130-usleep.patch b/net/rtorrent/patches/130-usleep.patch
new file mode 100644
index 000000000..c3463e4be
--- /dev/null
+++ b/net/rtorrent/patches/130-usleep.patch
@@ -0,0 +1,33 @@
+From b3d75a642177f21f00d18f0e46bca4a9f363d08e Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+Date: Fri, 23 Aug 2019 13:35:28 -0700
+Subject: [PATCH] Replace usleep with C++11 sleep_for
+
+usleep was deprecated with POSIX 2008 and optionally unavailable with
+uClibc-ng.
+---
+ src/thread_base.cc | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/thread_base.cc b/src/thread_base.cc
+index 081791d4..275015ab 100644
+--- a/src/thread_base.cc
++++ b/src/thread_base.cc
+@@ -42,6 +42,8 @@
+ #include <cstdlib>
+ #include <cstring>
+ #include <iostream>
++#include <chrono>
++#include <thread>
+ #include <signal.h>
+ #include <unistd.h>
+ #include <rak/error_number.h>
+@@ -66,7 +68,7 @@ class lt_cacheline_aligned thread_queue_hack {
+
+ thread_queue_hack() { std::memset(this, 0, sizeof(thread_queue_hack)); }
+
+- void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) usleep(0); }
++ void lock() { while (!__sync_bool_compare_and_swap(&m_lock, 0, 1)) std::this_thread::sleep_for(std::chrono::microseconds(0)); }
+ void unlock() { __sync_bool_compare_and_swap(&m_lock, 1, 0); }
+
+ iterator begin() { return m_queue; }