Re: reentrant library functions
- From: Chris Friesen <cbf123@xxxxxxxxxxxxx>
- Date: Wed, 17 Sep 2008 15:17:54 -0600
Mike wrote:
On Sep 16, 10:01 pm, David Schwartz <dav...@xxxxxxxxxxxxx> wrote:
First, to correct one error in your post, '-lpthread' is a linker flag
and has no effect on compiling. You probably mean '-pthread', which on
many platforms (including Linux), selects compiling and linking for
pthreads support.
I do not quite understand.
My functions use semaphores to ensure that any threaded access
is exclusive (sem_wait() and sem_post()). I need the '-lpthread' flag,
or else I get linker errors.
He's saying that it's more correct to specify "-pthread" rather than "-lpthread".
Technically "-lpthread" is only a linker flag, not a compiler flag. Some platforms also require a compiler flag such as -D_REENTRANT, and if you build/link with "-pthread" it will do the right thing.
Chris
.
- References:
- reentrant library functions
- From: Mike
- Re: reentrant library functions
- From: David Schwartz
- Re: reentrant library functions
- From: Mike
- reentrant library functions
- Prev by Date: Re: reentrant library functions
- Next by Date: Re: Kernel memory map question
- Previous by thread: Re: reentrant library functions
- Next by thread: Re: reentrant library functions
- Index(es):
Relevant Pages
|