Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Kaz Kylheku <kaz@xxxxxxxxxxx>
- Date: Tue, 17 Jan 2012 22:34:48 +0000 (UTC)
On 2012-01-17, Richard Kettlewell <rjk@xxxxxxxxxxxxxxx> wrote:
Kaz Kylheku <kaz@xxxxxxxxxxx> writes:
Jorgen Grahn <grahn+nntp@xxxxxxxxxxxxxx> wrote:
At one point -pthread was equivalent to -D_REENTRANT and -lpthread,
but that may change in the future if it has not already; it's better
to use the -pthread interface.
Either the gcc manual is incomplete, or your explanation is not
Whom are you going to believe, me or the GCC manual? :)
errno ends up indirected either way though (at least here).
"Either way" between which alternatives?
The -pthread option will have the effect of defining _REENTRANT so that
__errno_location ends up used. But -lpthread alone will not.
In /usr/include/bits/errno.h you have this:
# ifndef __ASSEMBLER__
/* Function to get address of global `errno' variable. */
extern int *__errno_location (void) __THROW __attribute__ ((__const__));
# if !defined _LIBC || defined _LIBC_REENTRANT
/* When using threads, errno is a per-thread value. */
# define errno (*__errno_location ())
# endif
# endif /* !__ASSEMBLER__ */
This part is included in /usr/include/errno.h, which then has this:
#ifndef errno
extern int errno;
#endif
.
- Follow-Ups:
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Richard Kettlewell
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- References:
- Calling libiptc API from a separate thread in a C program throws segmentati
- From: kkgarg78
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Kaz Kylheku
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Jorgen Grahn
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Kaz Kylheku
- Re: Calling libiptc API from a separate thread in a C program throws segmentati
- From: Richard Kettlewell
- Calling libiptc API from a separate thread in a C program throws segmentati
- Prev by Date: Re: Calling libiptc API from a separate thread in a C program throws segmentati
- Next by Date: Re: Calling libiptc API from a separate thread in a C program throws segmentati
- Previous by thread: Re: Calling libiptc API from a separate thread in a C program throws segmentati
- Next by thread: Re: Calling libiptc API from a separate thread in a C program throws segmentati
- Index(es):
Relevant Pages
|