* Problem using pthread library on Digital UNIX 3.2C
@ 1996-02-19 5:00 jaan
0 siblings, 0 replies; only message in thread
From: jaan @ 1996-02-19 5:00 UTC (permalink / raw)
I wonder if someone has some hints what I should do about
getting a SIGSEGV signal when just linking with the pthreads library.
I am running on Digital Alpha Server 1000 4/266 with 128Mb main
memory running Digital UNIX (formerly OSF1) version 3.2C "build" 148 alpha.
The swap space is set to more than 500Mb. The same problem exists
on OSF1 3.2A running on AlphaServer 200 4/100.
I have compiled all programs with -threads to cc (/usr/bin/cc). The program
does not use any threads. There is just a main(). When I link without
-lpthreads (and without -threads), i.e. -lmach -lc_r the program works.
The libraries I link are built with the default cc options, i.e. cc -g or -O,
(no difference, have tried both) and building "libraries" with ar, e.g. libfoo.a type.
The libraries also are compiled with the -std switch to cc -c (this to accept
some old "$" in variable names in the source). The code is ANSI-C, with function
prototypes.
The libraries make use of many "standard" UNIX calls (as in POSIX and XPG3)
and no BSD things expect sockets. The problem does not occur
in any socket or I/O related activity. (There are interesting ways to hang
the machine to require hard reset, using socket-related calls).
If I add link of the pthreads library, i.e. a command line that ends with
-lpthreads -lmach -lc_r
or
-lpthreads -lmach -lc_r -lc
or just
-threads
the program will receive a SIGSEGV (segmentation fault) signal when
referencing some malloced memory (that has been successfully accessed earlier in
the program). Depending what test sequences I run, the problem appears
in different location. But always when referencing malloced memory.
I will get the same effect compiling all code the default way (i.e. without
the -threads option), and just adding the -lpthreads option at the end
of the link (cc) command. But this is not supposed to work, I
guess
I do not expect there beeing any programming (or common malloc) problems.
This is old and well tested software running an many platforms and operating
systems.
Why do I need -lpthreads. I will (need to) use threads. In encountering
this problem in a thread, I now have reduced the problem beeing there
without any use of threads.
What does the link of -lpthreads change? What happens with the start-up
code for main()? May there be some problems with the stack size? Will
the main() (or procedures called from main()) in some way be run as
several (concurrent) threads anyway? If so, need for some global mutex ?
Is there any reference documentation that explains the pthreads library
in more detail? The implementation details? We already have e.g. Guide to DEDthreads.
All help and hints are appreciated. You may want to mail such directly to
jaan@basesoft.se. If I find a work-able solution, I will post the summary
to the net.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-02-19 5:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-02-19 5:00 Problem using pthread library on Digital UNIX 3.2C jaan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox