linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cesar Rincon <crincon@et.com.mx>
To: linux-c-programming@vger.kernel.org
Subject: Re: compiling programs which use pthreads
Date: Sun, 25 Jan 2004 03:44:54 -0600	[thread overview]
Message-ID: <20040125094454.GD1361@et.com.mx> (raw)
In-Reply-To: <40138B0E.8060406@home.se>

Ipsissima verba David Erman:
> 
> You need to link with  -lpthread. I.e.
> 
> gcc foo.c -lpthread

You should probably define _REENTRANT as well, e.g.

 gcc -D_REENTRANT -o foo foo.c -lpthread

so you get a per-thread errno and thread-safe "*_r" functions
(getlogin_r(), gethostbyaddr_r(), gethostbyname_r(), and many others).
See the "Feature Test Macros" section of the glibc manual, and of
course the "POSIX Threads" section for all the gory details.

 -CR

-- 
Ceterum censeo: SCO delenda est.

  reply	other threads:[~2004-01-25  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-25  9:36 compiling programs which use pthreads syedk
2004-01-25  9:23 ` David Erman
2004-01-25  9:44   ` Cesar Rincon [this message]
2004-01-25  9:56 ` Jan-Benedict Glaw

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040125094454.GD1361@et.com.mx \
    --to=crincon@et.com.mx \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).