Groups | Search | Server Info | Login | Register


Groups > comp.os.linux.development.system > #384

Re: Calling libiptc API from a separate thread in a C program throws segmentati

From Kaz Kylheku <kaz@kylheku.com>
Newsgroups comp.os.linux.development.system
Subject Re: Calling libiptc API from a separate thread in a C program throws segmentati
Date 2012-01-17 22:34 +0000
Organization A noiseless patient Spider
Message-ID <20120117141633.815@kylheku.com> (permalink)
References <bKSdndZeXcWVzYjS4p2dnAA@giganews.com> <20120117102310.171@kylheku.com> <slrnjhbpr9.1ls.grahn+nntp@frailea.sa.invalid> <20120117135234.277@kylheku.com> <87d3aif0ea.fsf@araminta.anjou.terraraq.org.uk>

Show all headers | View raw


On 2012-01-17, Richard Kettlewell <rjk@greenend.org.uk> wrote:
> Kaz Kylheku <kaz@kylheku.com> writes:
>> Jorgen Grahn <grahn+nntp@snipabacken.se> 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

Back to comp.os.linux.development.system | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Calling libiptc API from a separate thread in a C program throws segmentati kkgarg78 <nospam_kamalkgarg@gmail.com.invalid> - 2012-01-17 04:40 -0600
  Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 18:48 +0000
    Re: Calling libiptc API from a separate thread in a C program throws segmentati Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-17 21:26 +0000
      Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 22:03 +0000
        Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-17 22:07 +0000
          Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 22:34 +0000
            Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-17 22:51 +0000
              Re: Calling libiptc API from a separate thread in a C program throws segmentati Kaz Kylheku <kaz@kylheku.com> - 2012-01-17 23:13 +0000
        Re: Calling libiptc API from a separate thread in a C program throws segmentati Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-01-17 22:56 +0000
  Re: Calling libiptc API from a separate thread in a C program throws segmentati Richard Kettlewell <rjk@greenend.org.uk> - 2012-01-21 11:29 +0000

csiph-web