File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 36
36
37
37
#include " config.h"
38
38
39
+ #include < chrono>
40
+ #include < thread>
39
41
#include < functional>
40
42
#include < rak/functional.h>
41
- #include < unistd.h>
42
43
43
44
#include " torrent/exceptions.h"
44
45
#include " torrent/data/download_data.h"
@@ -135,7 +136,7 @@ HashQueue::remove(HashQueueNode::id_type id) {
135
136
136
137
while ((done_itr = m_done_chunks.find (hash_chunk)) == m_done_chunks.end ()) {
137
138
pthread_mutex_unlock (&m_done_chunks_lock);
138
- usleep ( 100 );
139
+ std::this_thread::sleep_for ( std::chrono::microseconds ( 100 ) );
139
140
pthread_mutex_lock (&m_done_chunks_lock);
140
141
}
141
142
Original file line number Diff line number Diff line change 37
37
#include " config.h"
38
38
39
39
#include < cstring>
40
+ #include < chrono>
41
+ #include < thread>
40
42
#include < signal.h>
41
- #include < unistd.h>
42
43
43
44
#include " exceptions.h"
44
45
#include " poll.h"
@@ -97,7 +98,7 @@ thread_base::stop_thread_wait() {
97
98
release_global_lock ();
98
99
99
100
while (!is_inactive ()) {
100
- usleep ( 1000 );
101
+ std::this_thread::sleep_for ( std::chrono::milliseconds ( 1 ) );
101
102
}
102
103
103
104
acquire_global_lock ();
@@ -161,7 +162,7 @@ thread_base::event_loop(thread_base* thread) {
161
162
}
162
163
163
164
// Add the sleep call when testing interrupts, etc.
164
- // usleep(50 );
165
+ // std::this_thread::sleep_for(std::chrono::microseconds(50) );
165
166
166
167
int poll_flags = 0 ;
167
168
You can’t perform that action at this time.
0 commit comments