Alexander Leidinger wrote:
> Hi,
> (14) netchild@ttyp2% uname -a
> FreeBSD 5.0-CURRENT FreeBSD 5.0-CURRENT #14: Fri Apr 21 
>17:28:37 CEST 2000     root@:/big/usr/src/sys/compile/WORK  i386
> I've an application which uses pthread_cond_{wait,broadcast}() and
> the debug output gives me the impression that the broadcast did not get
> delivered anymore.
> I run this program only occasionally, but with 4-current (last year) it
> worked, and I haven't changed anything mutex-/cond-related in it since
> then.
> I've attached a short test-prog (1.7k) which shows the same behavior,
> compile it with "cc -D_THREAD_SAFE -pthread test.c" and run "./a.out".

If you want it to work correctly, you have to make the second thread
release the mutex.  Look at it more closely:

    void *
    second_thread(void *arg)
      /* syncronize */
      fprintf(stderr, "Second: lock.\n");

      fprintf(stderr, "Second: broadcast.\n");

      fprintf(stderr, "Second: unlock.\n");

      fprintf(stderr, "Second: sleep.\n");

      fprintf(stderr, "Second: exit.\n");

Dan Eischen

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to