Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/testsuite/winsup.api/pthread/create1.c')
-rw-r--r--winsup/testsuite/winsup.api/pthread/create1.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/winsup/testsuite/winsup.api/pthread/create1.c b/winsup/testsuite/winsup.api/pthread/create1.c
new file mode 100644
index 000000000..192e52d9d
--- /dev/null
+++ b/winsup/testsuite/winsup.api/pthread/create1.c
@@ -0,0 +1,34 @@
+/*
+ * create1.c
+ *
+ * Description:
+ * Create a thread and check that it ran.
+ *
+ * Depends on API functions: None.
+ */
+
+#include "test.h"
+
+static int washere = 0;
+
+void * func(void * arg)
+{
+ washere = 1;
+ return 0;
+}
+
+int
+main()
+{
+ pthread_t t;
+
+ assert(pthread_create(&t, NULL, func, NULL) == 0);
+
+ /* A dirty hack, but we cannot rely on pthread_join in this
+ primitive test. */
+ Sleep(2000);
+
+ assert(washere == 1);
+
+ return 0;
+}