[libc++] Introduce an indirection to create threads in the test suite
We create threads using std::thread in various places in the test suite. However, the usual std::thread constructor may not work on all platforms, e.g. on platforms where passing a stack size is required to create a thread. This commit introduces a simple indirection that makes it easier to tweak how threads are created inside the test suite on various platforms. Note that tests that are purposefully calling std::thread's constructor directly (e.g. because that is what they're testing) were not modified.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
#include "make_test_thread.h"
|
||||
#include "test_macros.h"
|
||||
|
||||
class G
|
||||
@@ -52,7 +53,7 @@ int main(int, char**)
|
||||
assert(G::n_alive == 1);
|
||||
assert(!G::op_run);
|
||||
|
||||
std::thread t0(g);
|
||||
std::thread t0 = support::make_test_thread(g);
|
||||
std::thread::id id = t0.get_id();
|
||||
|
||||
std::thread t1 = std::move(t0);
|
||||
|
||||
Reference in New Issue
Block a user