Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Problem with Posix thread library
@ 1996-05-21  4:00 Deryk Barker
  1996-05-22  4:00 ` Burkhard Neidecker-Lutz
  0 siblings, 1 reply; 5+ messages in thread
From: Deryk Barker @ 1996-05-21  4:00 UTC (permalink / 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)




^ permalink raw reply	[flat|nested] 5+ messages in thread
* re: problem with posix thread library
@ 1996-05-22  4:00 sean levy
  1996-05-23  4:00 ` Burkhard Neidecker-Lutz
  0 siblings, 1 reply; 5+ messages in thread
From: sean levy @ 1996-05-22  4:00 UTC (permalink / raw)



Deryk Barker wrote:
> 
> Has anyone had any luck getting the pthreads library to run under
> Digital Unix on an Alpha?

[snip snip]

> 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());
                     ^^               ^^^^^^^^^^^^^^
> }
> 

under osf/1 [at least as of 3.2c, which is what i'm running] pthread_t is
a struct, not a pointer or integer. this is the worst of the interface
incompatibilities between dec's implementation and all others i've seen
so far, which don't hand structures around by value.

cheers,
				--sean
-- 
sean levy, sr. research programmer, n-dim group, edrc, carnegie mellon univ.
<snl+@cmu.edu> | http://paneer.ndim.edrc.cmu.edu/Home/snl | +1 412 268 5215



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-05-23  4:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-05-21  4:00 Problem with Posix thread library Deryk Barker
1996-05-22  4:00 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox