Skip to content

Commit 111989a

Browse files
author
Eric Holk
committed
Removed what seems to be the last of the calls to rand(). Closes #582.
1 parent 066bcc6 commit 111989a

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

src/rt/sync/sync.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ void sync::sleep(size_t timeout_in_ms) {
1919
#endif
2020
}
2121

22-
void sync::random_sleep(size_t max_timeout_in_ms) {
23-
sleep(rand() % max_timeout_in_ms);
24-
}
25-
2622
rust_thread::rust_thread() : _is_running(false), thread(0) {
2723
// Nop.
2824
}

src/rt/sync/sync.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ class sync {
55
public:
66
static void yield();
77
static void sleep(size_t timeout_in_ms);
8-
static void random_sleep(size_t max_timeout_in_ms);
98
template <class T>
109
static bool compare_and_swap(T *address,
1110
T oldValue, T newValue) {

src/rt/test/rust_test_runtime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rust_domain_test::worker::run() {
1515
for (int i = 0; i < TASKS; i++) {
1616
handle->create_task(NULL, "child");
1717
}
18-
sync::random_sleep(1000);
18+
sync::sleep(rand(&handle->rctx) % 1000);
1919
}
2020

2121
bool
@@ -62,6 +62,6 @@ rust_task_test::run() {
6262
worker->start();
6363
}
6464

65-
sync::random_sleep(1000);
65+
sync::sleep(rand(&kernel.sched->rctx) % 1000);
6666
return true;
6767
}

0 commit comments

Comments
 (0)