Implement pthread_yield.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@308 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/tests/pth_yield.c b/tests/pth_yield.c
new file mode 100644
index 0000000..0b708ba
--- /dev/null
+++ b/tests/pth_yield.c
@@ -0,0 +1,44 @@
+
+#include <stdio.h>
+#include <assert.h>
+
+#define __USE_GNU
+#include <pthread.h>
+
+void do_one_thing ( void* v )
+{
+  int i, j, res;
+  for (i = 0; i < 10; i++) {
+    for (j = 0; j < 10; j++) {
+       printf("a "); fflush(stdout);
+    }
+    printf("\naaaaaaa-yielding\n");
+    res = pthread_yield();
+    assert(res == 0);
+  }
+}
+
+void do_another_thing ( void* v )
+{
+  int i, j, res;
+  for (i = 0; i < 10; i++) {
+    for (j = 0; j < 10; j++) {
+       printf("b "); fflush(stdout);
+    }
+    printf("\nbbbbbbb-yielding\n");
+    res = pthread_yield();
+    assert(res == 0);
+  }
+}
+
+
+int main ( void )
+{
+  pthread_t t1, t2;
+  pthread_create( &t1, NULL, (void*)do_one_thing, NULL );
+  pthread_create( &t2, NULL, (void*)do_another_thing, NULL );
+  pthread_join(t1, NULL);
+  pthread_join(t2, NULL);
+  printf("bye!\n");
+  return 0;
+}