https://bugs.kde.org/show_bug.cgi?id=445743

--- Comment #4 from Paul Floyd <pjfl...@wanadoo.fr> ---
I can also reproduce the problem on FreeBSD.

What I see so far is that main runs all the way to pthread_join. contender does
not run at all, despite the sleep. Only after main is blocked in the
pthread_join does contender run. When it does run, the pthread_mutex_lock
fails.

If I change contender to be 

void *contender_start(void *arg)
{
  pthread_mutex_t *mutex = arg;
  fprintf(stderr, "contender trying to lock mutex\n");
  while (pthread_mutex_lock(mutex))
  {
     perror("contender error locking mutex:");
  }
  fprintf(stderr, "contender locked mutex\n");
  fprintf(stderr, "contender unlocking mutex\n");
  pthread_mutex_unlock(mutex);
  fprintf(stderr, "contender unlocked mutex\n");
  return NULL;
}

then I get

mutex initialized
main mutex locked
thread attributes initialized
contender trying to lock mutex
thread created
sleeping
signalling
joining thread
nullHandler running
contender error locking mutex:: Invalid argument

with the perror printed just once

I'll need to do a fairly long debugging session inside DRD and Valgrind core to
see what is happening there.

with --trace-mutex=yes

==5143== [2] post_mutex_lock error checking mutex 0x7fc000290 rc 1 owner 1
(locking failed)
... mutex for perror ...
==5143== [2] mutex_trylock   error checking mutex 0x7fc000290 rc 1 owner 1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to