From: dbarker@camosun.bc.ca (Deryk Barker)
Subject: Problem with Posix thread library
Date: 1996/05/21 [thread overview]
Message-ID: <4nt7ij$jdh@news.camosun.bc.ca> (raw)
Has anyone had any luck getting the pthreads library to run under
Digital Unix on an Alpha?
I have a brief test program (culled from the Sun Solaris man page
example) which works just fine on a SPARC under Solaris 2.5 but gets a
segmentation fault on the Alpha.
Any help would be appreciated.
Code and error message follow.
--
Deryk.
===========================================================================
|Deryk Barker, Computer Science Dept. | Across the pale parabola of Joy |
|Camosun College, Victoria, BC, Canada | |
|email: dbarker@camosun.bc.ca | Ralston McTodd |
|phone: +1 604 370 4452 | (Songs of Squalor). |
===========================================================================
#include <stdio.h>
#include <pthread.h>
#define NUM_THREADS 5
#define SLEEP_TIME 10
void *sleeping(void *); /* thread routine */
int i;
pthread_t tid[NUM_THREADS]; /* array of thread IDs */
main (int argc, char *argv[]){
for (i = 0; i < NUM_THREADS; i++)
pthread_create(&tid[i], pthread_attr_default, sleeping, &i);
/* pthread_attr_default is NULL in the Solaris version, but this gives
a warning on the Alpha
*/
for (i = 0; i < NUM_THREADS; i++)
pthread_join(tid[i], NULL);
printf("main() reporting that all %d threads have terminated\n", i);
} /* main */
void *sleeping (void *sleep_time){
printf("thread %d sleeping %d seconds ...\n", pthread_self(), SLEEP_TIME);
sleep (10);
printf("\nthread %d awakening\n", pthread_self());
}
Run from the shell this simply seg faults.
When run under dbx I get the following message:
signal Segmentation fault at >*[port_allocate, 0x3ff82008f5c] stq r26, 0(sp)
next reply other threads:[~1996-05-21 4:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-05-21 4:00 Deryk Barker [this message]
1996-05-22 4:00 ` Problem with Posix thread library Burkhard Neidecker-Lutz
1996-05-22 4:00 ` Charles M.Richmond
-- strict thread matches above, loose matches on Subject: below --
1996-05-22 4:00 problem with posix " sean levy
1996-05-23 4:00 ` Burkhard Neidecker-Lutz
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox