Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: denham@denham.zk3.dec.com (Jeffrey M. Denham)
Subject: Re: BookReader threads example crashes
Date: 1995/12/19	[thread overview]
Message-ID: <4b7g3k$92h@zk2nws.zko.dec.com> (raw)
In-Reply-To: 4b2q2j$i1l@harbinger.cc.monash.edu.au


In article <4b2q2j$i1l@harbinger.cc.monash.edu.au>, jvf@aurora.cc.monash.edu.au (J Frankland) writes:
>The threads programming example in the Guide to DECthreads (accessible
>by the bookreader) which conducts a prime number search, crashes.
>It is Example 5-1.  After compiling with the -lpthreads link flag, and
>running it, it Seg Faults before it get to the main() function.

You're building the programs incorrectly. The flag is -threads, not -lpthreads
etc.

cc -o prog proc.c -lwhatever1 -lwhatever2 -threads

The -threads switch insures the proper ordering of the other libraries
specified with the libraries required for running threads programs.
Build with just -lpthreads leaves out a few vital libraries. The
correct hand-crafted link would look like this:

cc -o prog prog.c -lwhatever1 -lwhatever2 -lpthreads -lmach -lc_r

libmach is the library used by the threads library to Mach threads stuff
with the kernel. libc_r is the thread-safe reentrant C runtime library.

NOTE: with V4.0 of Digital UNIX, due early next year, building threads
programs will change slightly.

To build "legacy" threaded application (ones based on 1003.1c/D4, as
in V3.2C and below):

cc -o prog prog.c -threads

To build "new" threaded applications based on the final pthreads standard
(1003.1c/D10):

cc -o prog prog.c -pthread

Note also that libc_r will go away. Instead, the only and only libc is
now thread safe.

Hope this is off some help to you.
-- 

-----------------------------------------------------------------------------
Jeff Denham, Unix Software Group, Digital Equipment Corporation
email: denham@zk3.dec.com, voice: (603) 881-0057



  reply	other threads:[~1995-12-19  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-12-18  5:00 BookReader threads example crashes J Frankland
1995-12-19  5:00 ` Jeffrey M. Denham [this message]
1995-12-21  5:00 ` Chris Davis 
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