delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/06/14/19:34:42

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: <03cb01c0f529$7b826020$0200a8c0@lifelesswks>
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: "Greg Smith" <rys AT epaibm DOT rtpnc DOT epa DOT gov>, <cygwin AT cygwin DOT com>
Cc: <cygwin-patches AT cygwin DOT com>
References: <3B290FE5 DOT 22678B61 AT trex DOT rtpnc DOT epa DOT gov>
Subject: Re: hang in pthread_cond_signal
Date: Fri, 15 Jun 2001 09:26:46 +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: 14 Jun 2001 23:16:26.0547 (UTC) FILETIME=[09093830:01C0F528]

------=_NextPart_000_03C8_01C0F57D.4C6DDF40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit


----- Original Message -----
From: "Greg Smith" <rys AT epaibm DOT rtpnc DOT epa DOT gov>
To: <cygwin AT cygwin DOT com>
Sent: Friday, June 15, 2001 5:26 AM
Subject: hang in pthread_cond_signal


> I am using the cygwin-src snapshot from June 10.
>
> Seems pthread_cond_signal can hang while another thread
> is waiting on the condition AND a pthread_cond_signal
> has been previously issued when no one was waiting on the
> condition.  Below is a testcase that illustrates the
> problem:
>
> Thanks,
>
> Greg
>

Thanks for the testcase Greg. The attached patch fixes your testcase.

Rob

Changelog:


Fri June 15 09:25:00  Robert Collins <rbtcollins AT hotmail DOT com>

    * thread.cc (pthread_cond::Signal): Release the condition access
variable correctly.



------=_NextPart_000_03C8_01C0F57D.4C6DDF40
Content-Type: application/octet-stream;
	name="cond_signal_fix.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="cond_signal_fix.patch"

Index: thread.cc=0A=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A=
RCS file: /cvs/src/src/winsup/cygwin/thread.cc,v=0A=
retrieving revision 1.33=0A=
diff -u -p -r1.33 thread.cc=0A=
--- thread.cc	2001/06/07 19:55:06	1.33=0A=
+++ thread.cc	2001/06/14 23:23:59=0A=
@@ -442,7 +442,12 @@ pthread_cond::Signal ()=0A=
   if (pthread_mutex_lock (&cond_access))=0A=
     system_printf ("Failed to lock condition variable access mutex, =
this %0p\n", this);=0A=
   if (!verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC))=0A=
-    return;=0A=
+    {=0A=
+      if (pthread_mutex_unlock (&cond_access))=0A=
+        system_printf ("Failed to unlock condition variable access =
mutex, this %0p\n",=0A=
+                       this);=0A=
+      return;=0A=
+    }=0A=
   PulseEvent (win32_obj_id);=0A=
   if (pthread_mutex_unlock (&cond_access))=0A=
     system_printf ("Failed to unlock condition variable access mutex, =
this %0p\n", this);=0A=


------=_NextPart_000_03C8_01C0F57D.4C6DDF40
Content-Type: text/plain; charset=us-ascii

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
------=_NextPart_000_03C8_01C0F57D.4C6DDF40--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019