Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Aug 2005 20:48:18 -0400 (EDT)
From:      Daniel Eischen <deischen@freebsd.org>
To:        Daniel Valencia <fetrovsky@yahoo.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: strange behaviour with pthread_cond_wait()
Message-ID:  <Pine.GSO.4.43.0508302045250.14550-100000@sea.ntplx.net>
In-Reply-To: <20050831003539.4702.qmail@web53913.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 30 Aug 2005, Daniel Valencia wrote:

> Hello, everybody...
>
> I have this multithreaded program, and there are these
> two threads that work together with a queue.  The
> backend receive thread reads packets and pushes them
> into the queue, while the frontend thread pops them
> off the queue to hand them to the caller.  This is an
> implementation of a software switch.
>
> The issue is, i have this little piece of code in the
> thread which actually performs the popping:

[ ... ]

> And when I runn my program, it will immediately exit.
> The message is:
>
> pthread_cond_wait: Unknown error: 0
>
> Not only that: the returned value (e) is 1, while
> EINVAL is 22.  According to the man pages, if

1 is EPERM.

And from the POSIX Spec (see
http://www.opengroup.org/onlinepubs/009695399/toc.htm):

  [EPERM]
      The mutex was not owned by the current thread at
      the time of the call.

I suggest Butenhof's "Programming with POSIX Threads" book.

-- 
DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.43.0508302045250.14550-100000>