summaryrefslogtreecommitdiff
path: root/nptl/cond-perf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-09-17 08:47:44 +0000
committerUlrich Drepper <drepper@redhat.com>2003-09-17 08:47:44 +0000
commita4db3439f1177cf5c5ceb80bfa3f3a2cef00fc0e (patch)
treee21a8cd5a2222281888d37b530d360e92995abd7 /nptl/cond-perf.c
parent6c052003bda07641309dcd4fe4a5158d24f5d607 (diff)
Update.
2003-09-15 Jakub Jelinek <jakub@redhat.com> * sysdeps/i386/Makefile (sysdep-CFLAGS): If not in math or csu subdir, add -mpreferred-stack-boundary=4, with few exceptions. 2003-09-17 Jakub Jelinek <jakub@redhat.com> * Makeconfig (stack-align-test-flags): Set. * stdlib/Makefile (CFLAGS-tst-bsearch.c): Add $(stack-align-test-flags). * stdlib/tst-bsearch.c: Include tst-stack-align.h. (align_check): New var. (comp): Use TEST_STACK_ALIGN macro. (do_test): Fail if align_check != 1. * sysdeps/generic/tst-stack-align.h: New file. * sysdeps/i386/i686/Makefile (stack-align-test-flags): Add -msse. * sysdeps/i386/i686/tst-stack-align.h: New file.
Diffstat (limited to 'nptl/cond-perf.c')
-rw-r--r--nptl/cond-perf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/nptl/cond-perf.c b/nptl/cond-perf.c
index 53d85637b8..e37914e6b7 100644
--- a/nptl/cond-perf.c
+++ b/nptl/cond-perf.c
@@ -4,6 +4,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <atomic.h>
static pthread_cond_t cond1 = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t mut1 = PTHREAD_MUTEX_INITIALIZER;
@@ -23,7 +24,7 @@ cons (void *arg)
do
{
- if (--ntogo == 0)
+ if (atomic_decrement_and_test (&ntogo))
{
pthread_mutex_lock (&mut2);
alldone = true;
@@ -68,11 +69,11 @@ main (int argc, char *argv[])
pthread_t th[nthreads];
int i;
- for (i = 0; i < nthreads; ++i)
+ for (i = 0; __builtin_expect (i < nthreads, 1); ++i)
if (__builtin_expect ((err = pthread_create (&th[i], NULL, cons, (void *) (long) i)) != 0, 0))
printf ("pthread_create: %s\n", strerror (err));
- for (i = 0; i < nrounds; ++i)
+ for (i = 0; __builtin_expect (i < nrounds, 1); ++i)
{
pthread_mutex_lock (&mut2);
while (! alldone)