Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tests/threads/newlib_stdio_test.c

Issue 3298014: Add a failing test for a race in newlib. (Closed) Base URL: http://nativeclient.googlecode.com/svn/trunk/src/native_client/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/threads/newlib_stdio_test.c
===================================================================
--- tests/threads/newlib_stdio_test.c (revision 0)
+++ tests/threads/newlib_stdio_test.c (revision 0)
@@ -0,0 +1,26 @@
+#include <pthread.h>
+#include <stdio.h>
+#include <unistd.h>
+
+void *thr0(void* arg) {
+ fopen("/tmp/z0", "w");
+ return 0;
+}
+
+void *thr1(void* arg) {
+ usleep(500000);
+ printf("success, %d\n", 1);
+ return 0;
+}
+
+int main(int argc, char *argv[]) {
+ pthread_t t0, t1;
+
+ pthread_create(&t0, NULL, thr0, NULL);
+ pthread_create(&t1, NULL, thr1, NULL);
+
+ pthread_join(t0, NULL);
+ pthread_join(t1, NULL);
+
+ return 0;
+}

Powered by Google App Engine
This is Rietveld 408576698