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
        [EMAIL PROTECTED]
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to