mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00
Tests/LibThreading: Port to Windows
This commit is contained in:
parent
b64a4a83a1
commit
28bfe701b7
Notes:
github-actions[bot]
2025-06-05 16:17:03 +00:00
Author: https://github.com/stasoid
Commit: 28bfe701b7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4964
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 6 additions and 6 deletions
|
@ -9,6 +9,7 @@ add_subdirectory(LibRIFF)
|
||||||
add_subdirectory(LibSyntax)
|
add_subdirectory(LibSyntax)
|
||||||
add_subdirectory(LibTest)
|
add_subdirectory(LibTest)
|
||||||
add_subdirectory(LibTextCodec)
|
add_subdirectory(LibTextCodec)
|
||||||
|
add_subdirectory(LibThreading)
|
||||||
add_subdirectory(LibUnicode)
|
add_subdirectory(LibUnicode)
|
||||||
add_subdirectory(LibURL)
|
add_subdirectory(LibURL)
|
||||||
add_subdirectory(LibXML)
|
add_subdirectory(LibXML)
|
||||||
|
@ -22,7 +23,6 @@ add_subdirectory(LibHTTP)
|
||||||
add_subdirectory(LibIPC)
|
add_subdirectory(LibIPC)
|
||||||
add_subdirectory(LibLine)
|
add_subdirectory(LibLine)
|
||||||
add_subdirectory(LibRequests)
|
add_subdirectory(LibRequests)
|
||||||
add_subdirectory(LibThreading)
|
|
||||||
add_subdirectory(LibTLS)
|
add_subdirectory(LibTLS)
|
||||||
add_subdirectory(LibWasm)
|
add_subdirectory(LibWasm)
|
||||||
add_subdirectory(LibWebSocket)
|
add_subdirectory(LibWebSocket)
|
||||||
|
|
|
@ -5,6 +5,7 @@ add_subdirectory(LibDiff)
|
||||||
add_subdirectory(LibGC)
|
add_subdirectory(LibGC)
|
||||||
add_subdirectory(LibJS)
|
add_subdirectory(LibJS)
|
||||||
add_subdirectory(LibRegex)
|
add_subdirectory(LibRegex)
|
||||||
|
add_subdirectory(LibThreading)
|
||||||
add_subdirectory(LibURL)
|
add_subdirectory(LibURL)
|
||||||
|
|
||||||
# FIXME: Increase support for building targets on Windows
|
# FIXME: Increase support for building targets on Windows
|
||||||
|
@ -16,7 +17,6 @@ add_subdirectory(LibCore)
|
||||||
add_subdirectory(LibDNS)
|
add_subdirectory(LibDNS)
|
||||||
add_subdirectory(LibTest)
|
add_subdirectory(LibTest)
|
||||||
add_subdirectory(LibTextCodec)
|
add_subdirectory(LibTextCodec)
|
||||||
add_subdirectory(LibThreading)
|
|
||||||
add_subdirectory(LibTLS)
|
add_subdirectory(LibTLS)
|
||||||
add_subdirectory(LibUnicode)
|
add_subdirectory(LibUnicode)
|
||||||
add_subdirectory(LibWasm)
|
add_subdirectory(LibWasm)
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Time.h>
|
#include <AK/Time.h>
|
||||||
|
#include <LibCore/System.h>
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
#include <LibThreading/Thread.h>
|
#include <LibThreading/Thread.h>
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
using namespace AK::TimeLiterals;
|
using namespace AK::TimeLiterals;
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ static void sleep_until_thread_exits(Threading::Thread const& thread)
|
||||||
if (thread.has_exited())
|
if (thread.has_exited())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
usleep(delay.to_microseconds());
|
(void)Core::System::sleep_ms(delay.to_milliseconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
FAIL("Timed out waiting for thread to exit");
|
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;
|
IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<int> should_be_42 = 0;
|
||||||
|
|
||||||
auto thread = Threading::Thread::construct([&should_be_42]() {
|
auto thread = Threading::Thread::construct([&should_be_42]() {
|
||||||
usleep(10 * 1000);
|
(void)Core::System::sleep_ms(10);
|
||||||
should_be_42 = 42;
|
should_be_42 = 42;
|
||||||
return 0;
|
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 };
|
IGNORE_USE_IN_ESCAPING_LAMBDA Atomic<bool> should_exit { false };
|
||||||
auto thread = Threading::Thread::construct([&]() {
|
auto thread = Threading::Thread::construct([&]() {
|
||||||
while (!should_exit.load())
|
while (!should_exit.load())
|
||||||
usleep(10 * 1000);
|
(void)Core::System::sleep_ms(10);
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
thread->start();
|
thread->start();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue