Skip to content

Commit a522dcf

Browse files
committed
Replace deprecated wait calls
1 parent fc8e8f6 commit a522dcf

File tree

37 files changed

+113
-110
lines changed

37 files changed

+113
-110
lines changed

TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,9 @@ void test_deepsleep(void)
313313
314314
* This should be replaced with a better function that checks if the
315315
* hardware buffers are empty. However, such an API does not exist now,
316-
* so we'll use the wait_ms() function for now.
316+
* so we'll use the ThisThread::sleep_for() function for now.
317317
*/
318-
wait_ms(20);
318+
ThisThread::sleep_for(20);
319319

320320
timer.start();
321321
timeout.attach_callback(mbed::callback(sem_callback, &sem), delay_us);

TESTS/mbed_hal/rtc/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void rtc_persist_test()
125125
rtc_write(start);
126126
rtc_free();
127127

128-
wait(WAIT_TIME);
128+
ThisThread::sleep_for(WAIT_TIME * 1000);
129129

130130
rtc_init();
131131
const uint32_t stop = rtc_read();
@@ -167,7 +167,7 @@ void rtc_range_test()
167167
for (uint32_t i = 0; i < sizeof(starts) / sizeof(starts[0]); i++) {
168168
const uint32_t start = starts[i];
169169
rtc_write(start);
170-
wait(WAIT_TIME);
170+
ThisThread::sleep_for(WAIT_TIME * 1000);
171171
const uint32_t stop = rtc_read();
172172
TEST_ASSERT_UINT32_WITHIN(WAIT_TOLERANCE, WAIT_TIME, stop - start);
173173
}

TESTS/mbed_platform/error_handling/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void test_error_logging_multithread()
228228
errThread[i] = new Thread(osPriorityNormal1, THREAD_STACK_SIZE, NULL, NULL);
229229
errThread[i]->start(callback(err_thread_func, &error_status[i]));
230230
}
231-
wait(2.0);
231+
ThisThread::sleep_for(2000);
232232
for (i = 0; i < NUM_TEST_THREADS; i++) {
233233
errThread[i]->join();
234234
}

TESTS/netsocket/dns/asynchronous_dns_cancel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ void ASYNCHRONOUS_DNS_CANCEL()
8181

8282
delete[] data;
8383

84-
wait(5.0);
84+
ThisThread::sleep_for(5000);
8585
}

TESTS/netsocket/dns/asynchronous_dns_external_event_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void ASYNCHRONOUS_DNS_EXTERNAL_EVENT_QUEUE()
7979
TEST_ASSERT_EQUAL(0, result_exp_timeout);
8080

8181
// Give event queue time to finalise before destructors
82-
wait(2.0);
82+
ThisThread::sleep_for(2000);
8383

8484
nsapi_dns_call_in_set(0);
8585
}

TESTS/netsocket/dns/asynchronous_dns_timeouts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void ASYNCHRONOUS_DNS_TIMEOUTS()
7474
TEST_ASSERT(result_exp_timeout > 0);
7575

7676
// Give event queue time to finalise before destructors
77-
wait(2.0);
77+
ThisThread::sleep_for(2000);
7878

7979
nsapi_dns_call_in_set(0);
8080
}

TESTS/netsocket/udp/udpsocket_echotest_burst.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void UDPSOCKET_ECHOTEST_BURST()
110110
} else if (recvd < 0) {
111111
pkg_fail += BURST_PKTS - j; // Assume all the following packets of the burst to be lost
112112
printf("[%02d] network error %d\n", i, recvd);
113-
wait(recv_timeout);
113+
ThisThread::sleep_for(recv_timeout * 1000);
114114
recv_timeout *= 2; // Back off,
115115
break;
116116
} else if (temp_addr != udp_addr) {

TESTS/netsocket/udp/udpsocket_sendto_repeat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void UDPSOCKET_SENDTO_REPEAT()
4545
break;
4646
}
4747
oom_earlier = true;
48-
wait(1);
48+
ThisThread::sleep_for(1000);
4949
continue;
5050
}
5151
oom_earlier = false;

TESTS/network/interface/networkinterface_status.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void NETWORKINTERFACE_STATUS_GET()
153153
TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, err);
154154

155155
while (net->get_connection_status() != NSAPI_STATUS_GLOBAL_UP) {
156-
wait(0.5);
156+
ThisThread::sleep_for(500);
157157
}
158158

159159
err = net->disconnect();

TEST_APPS/device/socket_app/cmd_socket.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ static void bg_traffic_thread(SInfo *info)
944944
tr_err("Background sent: \"%s\"", sbuffer);
945945
tr_err("Background received: \"%s\"", rbuffer);
946946
}
947-
wait_ms(10);
947+
ThisThread::sleep_for(10);
948948
}
949949
}
950950

0 commit comments

Comments
 (0)