This is the mail archive of the libc-alpha@sources.redhat.com 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]

pthread_rwlock_wrlock hangs with nptl


The following program (extracted from mysql) hangs with nptl but not
with linuxthreads on x86-64.

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


int main(void)
{
  pthread_rwlock_t LL;
  int ret;
  
  memset (&LL, 1, sizeof(LL));
  ret = pthread_rwlock_init(&LL, NULL);

  printf ("ret is: %d\n", ret);
  
  ret = pthread_rwlock_rdlock(&LL);
  printf ("ret is: %d\n", ret);
  ret = pthread_rwlock_unlock(&LL);
  printf ("ret is: %d\n", ret);
  ret = pthread_rwlock_wrlock(&LL); /* hangs with nptl */
  printf ("ret is: %d\n", ret);

  return 0;
}

After the rwlock_unlock, we have:
(gdb) p LL
$7 = {__data = {__lock = 0, __nr_readers = 1, __readers_wakeup = 0,
    __writer_wakeup = 0, __nr_readers_queued = 0, __nr_writers_queued = 0,
    __writer = 0, __pad1 = 0, __pad2 = 18446744073709551615,
    __pad3 = 18446744073709551615, __flags = 0},
  __size = "\000\000\000\000\001", '\0' <repeats 27 times>, 'ÿ' <repeats 16 times>, "\000\000\000\000ÿÿÿÿ", __align = 4294967296}

and then the pthread_rwlock_wrlock hangs...

Any ideas what's wrong here?

Andreas
-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Maxfeldstr. 5, 90409 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

Attachment: pgp00000.pgp
Description: PGP signature


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