Skip to content

Commit de305d2

Browse files
committed
Add wait mechanism in node signal handler test.
1 parent 97c183d commit de305d2

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

source/tests/metacall_node_signal_handler_test/source/metacall_node_signal_handler_test.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <metacall/metacall_loaders.h>
2525

2626
#include <atomic>
27+
#include <chrono>
28+
#include <thread>
2729

2830
std::atomic_bool callback_result(false);
2931
std::atomic_bool signal_result(false);
@@ -120,6 +122,11 @@ TEST_F(metacall_node_signal_handler_test, DefaultConstructor)
120122
metacall_allocator_destroy(allocator);
121123
}
122124

125+
/* Apparently it seems to fail randomly due to a race condition between processes
126+
and I do not want to implement a wait mechanism because this is just a PoC.
127+
TODO: I am not sure but could this be related to the destroy mechanism of NodeJS? We should review it */
128+
std::this_thread::sleep_for(std::chrono::seconds(10));
129+
123130
EXPECT_EQ((int)0, (int)metacall_destroy());
124131

125132
EXPECT_EQ((bool)callback_result.load(), (bool)true);

0 commit comments

Comments
 (0)