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>
39
40
#include < functional>
40
- #include < unistd.h >
41
+ #include < thread >
41
42
42
43
#include " torrent/exceptions.h"
43
44
#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 1
1
#include " config.h"
2
2
3
+ #include < chrono>
3
4
#include < cstring>
4
5
#include < signal.h>
5
- #include < unistd.h >
6
+ #include < thread >
6
7
7
8
#include " torrent/exceptions.h"
8
9
#include " torrent/poll.h"
@@ -60,7 +61,7 @@ thread_base::stop_thread_wait() {
60
61
release_global_lock ();
61
62
62
63
while (!is_inactive ()) {
63
- usleep ( 1000 );
64
+ std::this_thread::sleep_for ( std::chrono::milliseconds ( 1 ) );
64
65
}
65
66
66
67
acquire_global_lock ();
@@ -132,7 +133,7 @@ thread_base::event_loop(thread_base* thread) {
132
133
}
133
134
134
135
// Add the sleep call when testing interrupts, etc.
135
- // usleep(50 );
136
+ // std::this_thread::sleep_for(std::chrono::microseconds(50) );
136
137
137
138
int poll_flags = 0 ;
138
139
You can’t perform that action at this time.
0 commit comments