| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Message-ID: | <011101c14a11$259955f0$01000001@lifelesswks> |
| From: | "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au> |
| To: | "Jean Barata" <y DOT curtis AT free DOT fr>, <cygwin AT cygwin DOT com> |
| References: | <000501c149eb$9520edf0$022133c6 AT murphy> |
| Subject: | Re: Bug in pthread ? |
| Date: | Mon, 1 Oct 2001 10:36:43 +1000 |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook Express 5.50.4133.2400 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
| X-OriginalArrivalTime: | 01 Oct 2001 00:43:50.0374 (UTC) FILETIME=[2336B860:01C14A12] |
----- Original Message -----
From: "Jean Barata" <y DOT curtis AT free DOT fr>
To: <cygwin AT cygwin DOT com>
Sent: Monday, October 01, 2001 6:07 AM
Subject: Bug in pthread ?
> Hello,
>
> Here is the problem:
> if I don't "initialiaze" the mutex in the constructor, it works in any
case.
> but if I "initialize" it, it worked with cygwin1.dll (v1.3.2) and not
> anymore with cygwin1.dll (v1.3.3)
> when calling the function "fct", the program waits forever on the
> "pthread_mutex_lock" instruction (and if I debug it with GDB: &_mutex
is
> NULL)
>
> so, is it a bug or is it normal ???
>
>
> class A {
> public:
> A();
> void fct(void);
> private:
> pthread_mutex_t _mutex;
> pthread_mutexattr_t _mutex_attr;
> };
>
> A::A() {
> pthread_mutexattr_init(&_mutex_attr);
> pthread_mutex_init(&_mutex, &_mutex_attr);
> pthread_mutex_unlock(&_mutex); /*********** BUG ???
**************/
This is a bug in your code. You are unlocking an already unlocked mutex.
Cygwin should return EPERM to that call - and I note you are note
checking any error codes from the system calls, which is quite dangerou
programming style.
You might like to check
http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_mutex_unlock.h
tml
and
http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_mutex_init.htm
l
Rob
> }
>
> void A::fct(void) {
> pthread_mutex_lock(&_mutex); /********** WAITING HERE ...
************/
> ...
> pthread_mutex_unlock(&_mutex);
> }
>
>
>
> --
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
> Bug reporting: http://cygwin.com/bugs.html
> Documentation: http://cygwin.com/docs.html
> FAQ: http://cygwin.com/faq/
>
>
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |