diff options
Diffstat (limited to 'linuxthreads')
-rw-r--r-- | linuxthreads/ChangeLog | 10 | ||||
-rw-r--r-- | linuxthreads/Examples/ex11.c | 6 | ||||
-rw-r--r-- | linuxthreads/Examples/ex14.c | 4 | ||||
-rw-r--r-- | linuxthreads/Examples/ex3.c | 4 | ||||
-rw-r--r-- | linuxthreads/Examples/ex8.c | 4 | ||||
-rw-r--r-- | linuxthreads/ecmutex.c | 6 |
6 files changed, 23 insertions, 11 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 685f8ef04f..215ceff586 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,13 @@ +2000-11-20 Jakub Jelinek <jakub@redhat.com> + + * Examples/ex3.c (main): Cast int to long before casting to void *. + (search): Cast void * to long, not int. + * Examples/ex8.c (main, thread): Similarly. + * Examples/ex11.c (main): Similarly. + * Examples/ex14.c (worker, do_test): Similarly. + * ecmutex.c (worker, do_test): Similarly. + (nlocks): Cast to int. + 2000-11-08 Bruce Mitchener <bruce@cubik.org> * linuxthreads.texi: Add documentation for pthreads attributes diff --git a/linuxthreads/Examples/ex11.c b/linuxthreads/Examples/ex11.c index fb09d64561..a01d18db36 100644 --- a/linuxthreads/Examples/ex11.c +++ b/linuxthreads/Examples/ex11.c @@ -128,7 +128,8 @@ main (void) for (n = 0; n < NWRITERS; ++n) { - int err = pthread_create (&thwr[n], NULL, writer_thread, (void *) n); + int err = pthread_create (&thwr[n], NULL, writer_thread, + (void *) (long int) n); if (err != 0) error (EXIT_FAILURE, err, "cannot create writer thread"); @@ -136,7 +137,8 @@ main (void) for (n = 0; n < NREADERS; ++n) { - int err = pthread_create (&thrd[n], NULL, reader_thread, (void *) n); + int err = pthread_create (&thrd[n], NULL, reader_thread, + (void *) (long int) n); if (err != 0) error (EXIT_FAILURE, err, "cannot create reader thread"); diff --git a/linuxthreads/Examples/ex14.c b/linuxthreads/Examples/ex14.c index 9d2c987347..7788e521b8 100644 --- a/linuxthreads/Examples/ex14.c +++ b/linuxthreads/Examples/ex14.c @@ -19,7 +19,7 @@ static void * worker (void *arg) { void *result = NULL; - int nr = (int) arg; + int nr = (long int) arg; int i; for (i = 0; i < ROUNDS; ++i) @@ -110,7 +110,7 @@ do_test (void) /* Start the threads. */ for (i = 0; i < NTHREADS; ++i) - if (pthread_create (&threads[i], NULL, worker, (void *) i) != 0) + if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0) { printf ("Failed to start thread %d\n", i); exit (1); diff --git a/linuxthreads/Examples/ex3.c b/linuxthreads/Examples/ex3.c index 8005200eff..b80b323a33 100644 --- a/linuxthreads/Examples/ex3.c +++ b/linuxthreads/Examples/ex3.c @@ -35,7 +35,7 @@ int main(int argc, char ** argv) /* Create the searching threads */ for (started=0; started<NUM_THREADS; started++) - pthread_create(&threads[started], NULL, search, (void *)pid); + pthread_create(&threads[started], NULL, search, (void *) (long int) pid); /* Wait for (join) all the searching threads */ for (i=0; i<NUM_THREADS; i++) @@ -66,7 +66,7 @@ void print_it(void *arg) void *search(void *arg) { - int num = (int) arg; + int num = (long int) arg; int i, j, ntries; pthread_t tid; diff --git a/linuxthreads/Examples/ex8.c b/linuxthreads/Examples/ex8.c index 1b9b335579..1976bfb0a3 100644 --- a/linuxthreads/Examples/ex8.c +++ b/linuxthreads/Examples/ex8.c @@ -68,7 +68,7 @@ main (void) pthread_join (th, &res); - return (int) res; + return (int) (long int) res; } @@ -97,5 +97,5 @@ thread (void *arg) if (status == 0) status = var != (PREPARE_BIT | PARENT_BIT); - return (void *) status; + return (void *) (long int) status; } diff --git a/linuxthreads/ecmutex.c b/linuxthreads/ecmutex.c index b9d1d54352..a47bd099c8 100644 --- a/linuxthreads/ecmutex.c +++ b/linuxthreads/ecmutex.c @@ -14,7 +14,7 @@ static pthread_mutex_t locks[] = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP, PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP }; -#define nlocks (sizeof (locks) / sizeof (locks[0])) +#define nlocks ((int) (sizeof (locks) / sizeof (locks[0]))) static pthread_barrier_t barrier; #define SYNC pthread_barrier_wait (&barrier) @@ -30,7 +30,7 @@ worker (void *arg) /* We are locking the and unlocked the locks and check the errors. Since we are using the error-checking variant the implementation should report them. */ - int nr = (int) arg; + int nr = (long int) arg; int i; void *result = NULL; int retval; @@ -141,7 +141,7 @@ do_test (void) pthread_barrier_init (&barrier, NULL, NTHREADS); for (i = 0; i < NTHREADS; ++i) - if (pthread_create (&threads[i], NULL, worker, (void *) i) != 0) + if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0) { printf ("failed to create thread %d: %m\n", i); exit (1); |