[Bug 254995] pthread_cond_timedwait() returns EDEADLK

[email protected]
Newsgroups gmane.os.freebsd.devel.threading
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254995

--- Comment #2 from [email protected] ---
Yes, that is the thread that dead locks.

I do not stop the process (to my knowledge).

I am having a simple producer-consumer queue with 2 conds not_empty and
not_full and one mutex (process local, PTHREAD_MUTEX_ERRORCHECK,
PTHREAD_PRIO_INHERIT).
EDEADLK comes from the consumer waiting for anything with timeout.
The timeout is 100ms only as there is a regular keep alive check of
this thread.
The producer never waits.

So its basically this:

consumer thread:
  for(;;) {
    pthread_mutex_lock()
    if queue_empty()
      phtread_cond_timedwait() // <-- EDEADLK once in a month
    if !queue_empty() {
      read from queue
      pthread_cond_signal(not_full)
    }
    pthread_mutex_unlock()
    signal_alive()
    do_something()
  }


producer thread:
  ...
  pthread_mutex_lock()
  if !queue_full() {
    write to queue
    pthread_cond_signal(not_empty)
  }
  pthread_mutex_unlock()
  ...


BTW, there are about 32 threads with different realtime priorities and the
programs very often forks/execs other programs.

I have never seen this under FreeBSD 10.3 and 9.1 with the same software, but
that may of course mean that there were other effects I did not see so far.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.