Re: problem handling POSIX thread on FreeBSD

From: Dan Nelson (dnelson_at_allantgroup.com)
Date: 06/27/05

  • Next message: Pablo Mora: "Re: problem handling POSIX thread on FreeBSD"
    Date: Sun, 26 Jun 2005 23:19:58 -0500
    To: Pablo Mora <fbsd.hackers@gmail.com>
    
    

    In the last episode (Jun 26), Pablo Mora said:
    > int main() {
    > ....
    > if(pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM) != 0)
    > /* handler */
    > ....
    > }
    >
    > $ gcc taller.c -pthread
    > $ ./a.out
    > pthread_attr_setscope: Unknown error: 0
    > $
    >
    > PTHREAD_SCOPE_SYSTEM fail on freebsd ?

    The libc_r and libthr threads libraries do not support
    PTHREAD_SCOPE_SYSTEM. The standard does not require support for both
    PTHREAD_SCOPE_PROCESS and PTHREAD_SCOPE_SYSTEM, so it's better if you
    don't treat failure of pthread_attr_setscope() as fatal to the program.
    If you're running FreeBSD 4.0, your only choice of threads library is
    libc_r.

    Also note that the pthread_attr_*() functions are special in that they
    do not set the errno variable. They return their error code, so you
    need to do something like:

      rv = pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
      if (rv && rv != ENOTSUP)
        handle_error();

    -- 
    	Dan Nelson
    	dnelson@allantgroup.com
    _______________________________________________
    freebsd-hackers@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
    To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
    

  • Next message: Pablo Mora: "Re: problem handling POSIX thread on FreeBSD"

    Relevant Pages

    • compile error on alpha - binutils problem?
      ... {standard input}:246: Error: macro requires $at register while noat in effect ... # PCCARD support ...
      (Linux-Kernel)
    • Re: New Ethiopian Find - Oldest Biped At 3.8-4 mya
      ... >> This is not an example of a double standard. ... > criticise arguments you don't support for not ... *elimination of human hair as it relates to swimming. ... primarily--neither set out to address hair reduction) required a rather ...
      (sci.anthropology.paleo)
    • Re: Is C99 the final C? (some suggestions)
      ... >>fully start to support C99, It will be a good day when I can actually ... > this would require would be a standard minimum mantissa length. ... >> supported by a mandatory compiler warning). ... >> calls invocations that an implementation needs to support. ...
      (comp.lang.c)
    • Re: So what Standard are we working off?
      ... But C99 basically addresses none of these problems over C89. ... do support this with direct, ... libraries implementable completely in standard C, ... standard library as well. ...
      (comp.lang.c)
    • Re: why still use C?
      ... It was big High-Energy Physics ... > experiment, with a total project time of more than a decade, and still ... standard to accommodate people who `solve' problems this way. ... And once you support more two, ...
      (comp.lang.c)