]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd/tests/thrd_create: Convert from C++ to C
authorBart Van Assche <bvanassche@acm.org>
Mon, 16 Oct 2023 13:21:03 +0000 (06:21 -0700)
committerBart Van Assche <bvanassche@acm.org>
Mon, 16 Oct 2023 13:27:46 +0000 (06:27 -0700)
drd/tests/Makefile.am
drd/tests/thrd_create.c [new file with mode: 0644]
drd/tests/thrd_create.cpp [deleted file]

index e0af0a22b8c97c0d27f093aa5bc063b1377ea239..819ce3e2d2ccd5b4badfdf7966bfc33f864584e2 100755 (executable)
@@ -660,7 +660,7 @@ endif
 timed_mutex_SOURCES         = timed_mutex.cpp
 timed_mutex_CXXFLAGS        = $(AM_CXXFLAGS) -std=c++0x
 
-thrd_create_SOURCES        = thrd_create.cpp
+thrd_create_SOURCES        = thrd_create.c
 if VGCONF_OS_IS_FREEBSD
 thrd_create_LDFLAGS          = -lstdthreads
 endif
diff --git a/drd/tests/thrd_create.c b/drd/tests/thrd_create.c
new file mode 100644 (file)
index 0000000..8553fca
--- /dev/null
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <threads.h>
+
+int thread_entry(void *arg)
+{
+  fprintf(stderr, "Hello, world!\n");
+  return 0;
+}
+
+int main()
+{
+  thrd_t thr;
+  thrd_create(&thr, thread_entry, NULL);
+  thrd_join(thr, NULL);
+  return 0;
+}
diff --git a/drd/tests/thrd_create.cpp b/drd/tests/thrd_create.cpp
deleted file mode 100644 (file)
index b0f3eee..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <threads.h>
-#include <iostream>
-
-int main()
-{
-  thrd_t thr;
-  thrd_create(&thr, [](void *arg){std::cerr << "Hello, world!\n"; return 0;},
-              NULL);
-  thrd_join(thr, NULL);
-  return 0;
-}