This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/15790] pthread_mutexattr_gettype doesn't store the value of the 'type' attribute into *type


https://sourceware.org/bugzilla/show_bug.cgi?id=15790

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
This also means that the value returned by pthread_mutexattr_gettype is not a
valid input to pthread_mutexattr_settype.

#include <stdio.h>
#include <string.h>
#include <pthread.h>

int
main (void)
{
  pthread_mutexattr_t attr;
  int kind;
  int error;

  error = pthread_mutexattr_init (&attr);
  if (error)
    fprintf (stderr, "pthread_mutexattr_init: %s\n", strerror (error));
  error = pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_DEFAULT);
  if (error)
    fprintf (stderr, "pthread_mutexattr_settype (1): %s\n", strerror (error));
  error = pthread_mutexattr_gettype (&attr, &kind);
  if (error)
    fprintf (stderr, "pthread_mutexattr_gettype: %s\n", strerror (error));
  error = pthread_mutexattr_settype (&attr, kind);
  if (error)
    fprintf (stderr, "pthread_mutexattr_settype (2): %s\n", strerror (error));
}

pthread_mutexattr_settype (2): Invalid argument

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]