summaryrefslogtreecommitdiff
path: root/nptl/tst-attr1.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-13 19:50:46 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-13 19:50:46 +0000
commite8cda341a4e8893a5932a0d22440e7c191c37564 (patch)
tree153610ed89e615fb1475ae0c3ab897726cb652c1 /nptl/tst-attr1.c
parent89e78a954dbd659e0e118aa577d0656363d3c1c2 (diff)
Update.
2003-02-13 Ulrich Drepper <drepper@redhat.com> * Makefile (tests): Add tst-cleanup3. * tst-cleanup3.c: New file.
Diffstat (limited to 'nptl/tst-attr1.c')
-rw-r--r--nptl/tst-attr1.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/nptl/tst-attr1.c b/nptl/tst-attr1.c
index 5c86a1fa20..bfa7075018 100644
--- a/nptl/tst-attr1.c
+++ b/nptl/tst-attr1.c
@@ -35,6 +35,11 @@ do_test (void)
exit (1);
}
+ /* XXX Remove if default value is clear. */
+ pthread_attr_setinheritsched (&a, PTHREAD_INHERIT_SCHED);
+ pthread_attr_setschedpolicy (&a, SCHED_OTHER);
+ pthread_attr_setscope (&a, PTHREAD_SCOPE_SYSTEM);
+
for (i = 0; i < 10000; ++i)
{
long int r = random ();
@@ -63,6 +68,81 @@ detach state changed to %d by invalid setdetachstate call\n", s);
exit (1);
}
}
+
+ if (r != PTHREAD_INHERIT_SCHED && r != PTHREAD_EXPLICIT_SCHED)
+ {
+ int e = pthread_attr_setinheritsched (&a, r);
+
+ if (e == 0)
+ {
+ printf ("attr_setinheritsched with value %ld succeeded\n", r);
+ exit (1);
+ }
+
+ int s;
+ if (pthread_attr_getinheritsched (&a, &s) != 0)
+ {
+ puts ("attr_getinheritsched failed");
+ exit (1);
+ }
+
+ if (s != PTHREAD_INHERIT_SCHED)
+ {
+ printf ("\
+inheritsched changed to %d by invalid setinheritsched call\n", s);
+ exit (1);
+ }
+ }
+
+ if (r != SCHED_OTHER && r != SCHED_RR && r != SCHED_FIFO)
+ {
+ int e = pthread_attr_setschedpolicy (&a, r);
+
+ if (e == 0)
+ {
+ printf ("attr_setschedpolicy with value %ld succeeded\n", r);
+ exit (1);
+ }
+
+ int s;
+ if (pthread_attr_getschedpolicy (&a, &s) != 0)
+ {
+ puts ("attr_getschedpolicy failed");
+ exit (1);
+ }
+
+ if (s != SCHED_OTHER)
+ {
+ printf ("\
+schedpolicy changed to %d by invalid setschedpolicy call\n", s);
+ exit (1);
+ }
+ }
+
+ if (r != PTHREAD_SCOPE_SYSTEM && r != PTHREAD_SCOPE_PROCESS)
+ {
+ int e = pthread_attr_setscope (&a, r);
+
+ if (e == 0)
+ {
+ printf ("attr_setscope with value %ld succeeded\n", r);
+ exit (1);
+ }
+
+ int s;
+ if (pthread_attr_getscope (&a, &s) != 0)
+ {
+ puts ("attr_getscope failed");
+ exit (1);
+ }
+
+ if (s != PTHREAD_SCOPE_SYSTEM)
+ {
+ printf ("\
+contentionscope changed to %d by invalid setscope call\n", s);
+ exit (1);
+ }
+ }
}
return 0;