diff --git a/test/test.c b/test/test.c index 243648cf4..0efa42f19 100644 --- a/test/test.c +++ b/test/test.c @@ -840,6 +840,14 @@ sumThread(void *arg) static int NUM_THREADS = 1000; +int _race = 0; +static void testThreadRace(void *arg) +{ + test("testThreadRace: "); + _race = 1; + testCond(1); +} + static void test_natsThread(void) { @@ -851,6 +859,20 @@ test_natsThread(void) natsThread **threads = NULL; int i,j; + test("Create thread: "); + s = natsThread_Create(&t, testThreadRace, &tArgs); + testCond(s == NATS_OK); + test("main thread: "); + _race = 2; + testCond(1); + test("Joining thread: "); + natsThread_Join(t); + testCond(1); + test("Destroy thread: "); + natsThread_Destroy(t); + testCond(1); + return; + if (valgrind) NUM_THREADS = 100;