From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,7971b9ebdbe2369,start X-Google-Attributes: gidfee84,public From: dbarker@camosun.bc.ca (Deryk Barker) Subject: Problem with Posix thread library Date: 1996/05/21 Message-ID: <4nt7ij$jdh@news.camosun.bc.ca>#1/1 X-Deja-AN: 155976492 organization: Camosun College, Victoria B.C. newsgroups: comp.unix.osf.osf1 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 #include #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)