Tests/LibThreading: Port to Windows
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macOS, macos-15, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, Linux, blacksmith-16vcpu-ubuntu-2404, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, Linux, blacksmith-16vcpu-ubuntu-2404, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macOS, macOS-arm64, macos-15) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, Linux, Linux-x86_64, blacksmith-8vcpu-ubuntu-2404) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
stasoid 2025-06-02 13:56:10 +05:00 committed by Andrew Kaster
commit 28bfe701b7
Notes: github-actions[bot] 2025-06-05 16:17:03 +00:00
3 changed files with 6 additions and 6 deletions

View file

@ -5,9 +5,9 @@
*/
#include <AK/Time.h>
#include <LibCore/System.h>
#include <LibTest/TestCase.h>
#include <LibThreading/Thread.h>
#include <unistd.h>
using namespace AK::TimeLiterals;
@ -19,7 +19,7 @@ static void sleep_until_thread_exits(Threading::Thread const& thread)
if (thread.has_exited())
return;
usleep(delay.to_microseconds());
(void)Core::System::sleep_ms(delay.to_milliseconds());
}
FAIL("Timed out waiting for thread to exit");
@ -30,7 +30,7 @@ TEST_CASE(threads_can_detach)
IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<int> should_be_42 = 0;
auto thread = Threading::Thread::construct([&should_be_42]() {
usleep(10 * 1000);
(void)Core::System::sleep_ms(10);
should_be_42 = 42;
return 0;
});
@ -46,7 +46,7 @@ TEST_CASE(detached_threads_do_not_need_to_be_joined)
IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool> should_exit { false };
auto thread = Threading::Thread::construct([&]() {
while (!should_exit.load())
usleep(10 * 1000);
(void)Core::System::sleep_ms(10);
return 0;
});
thread->start();