delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/13/16:29:09

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
Date: Fri, 13 Jul 2001 16:10:28 -0400 (EDT)
From: Ken Tew <ken2 AT andrew DOT cmu DOT edu>
To: cygwin AT cygwin DOT com
Subject: Bug in pthread_cond_signal under Win NT 4.0
Message-ID: <Pine.LNX.4.21L-021.0107131554450.6237-300000@unix47.andrew.cmu.edu>
MIME-Version: 1.0

--42006283-6672078-995055028=:6237
Content-Type: TEXT/PLAIN; charset=US-ASCII


If you signal a condition variable without any threads actually waiting  
on the condition variable, then when a thread does wait on that variable
it will hang. 

I've attached the file pthread_bug_test.cpp which is a simple program to 
demonstrate the bug.

I also attached a modified thread.cc which fixes the bug.  It simply
checks to see if any threads are waiting on the condition before
signalling.  The only change I made to thread.cc was adding the line: 
  if (waiting) 
at line 452 in the file.  

----------
                                          \//////
                                          [ O o ]
 Ken Tew - Licensed to Program             \_=_/
   http://www.pitt.edu/~ktew               _| |_
                                          / \_/ \
________________________________________oOOO___OOOo__

--42006283-6672078-995055028=:6237
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="pthread_bug_test.cpp"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT LNX DOT 4 DOT 21L-021 DOT 0107131610280 DOT 6237 AT unix47 DOT andrew DOT cmu DOT edu>
Content-Description: test code to show bug
Content-Disposition: attachment; filename="pthread_bug_test.cpp"

I2luY2x1ZGUgPHB0aHJlYWQuaD4NCiNpbmNsdWRlIDxzZW1hcGhvcmUuaD4N
CiNpb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o
JmNvbmQsIE5VTEwpOw0KICBzZW1faW5pdCgmc2VtaWUsIDAsIDApOw0KDQog
IHB0aHJlYWRfY3JlYXRlKCZjaGlsZCwgTlVMTCwgdGhyZWFkX3N0YXJ0LCBO
VUxMKTsNCg0KICAvKiB3YWl0IHVudGlsIGNoaWxkIGdyYWJzIGxvY2sgc28g
c2lnbmFsIGNhbiBiZSBzZW50IGJlZm9yZSB3YWl0aW5nIA0KICAgICBzdGFy
dHMNCiAgKi8NCiAgDQogIHByaW50ZigiSW5pdGlhbGl6YXRpb24gZG9uZVxu
Iik7DQogIHNlbV93YWl0KCZzZW1pZSk7DQoNCiAgcHRocmVhZF9tdXRleF9s
b2NrKCZtdXRpZSk7DQogIHdhaXRpbmc9MTsNCiAgc2VtX3Bvc3QoJnNlbWll
KTsgLy8gd2FrZSBjaGlsZCBub3cgdGhhdCBwYXJlbnQgaGFzIGxvY2sNCiAg
cHJpbnRmKCJNYWluIGxvY2tlZCBtdXRleCwgYWJvdXQgdG8gd2FpdCBvbiBj
b25kaXRpb25cbiIpOw0KICBwdGhyZWFkX2NvbmRfd2FpdCgmY29uZCwgJm11
dGllKTsNCiAgd2FpdGluZz0wOw0KICBwcmludGYoIk1haW4gd29rZSBmcm9t
IGNvbmRpdGlvblxuIik7DQogIHB0aHJlYWRfbXV0ZXhfdW5sb2NrKCZtdXRp
ZSk7DQoNCg0KICBwdGhyZWFkX2pvaW4oJmNoaWxkLE5VTEwpOw0KDQp9DQo=
--42006283-6672078-995055028=:6237
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="thread.cc"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine DOT LNX DOT 4 DOT 21L-021 DOT 0107131610281 DOT 6237 AT unix47 DOT andrew DOT cmu DOT edu>
Content-Description: fixed file
Content-Disposition: attachment; filename="thread.cc"

LyogdGhyZWFkLmNjOiBMb2NraW5nIGFuZCB0aHJlYWRpbmcgbW9kdWxlIGZ1
bmN0aW9ucw0NCg0NCiAgIENvcHly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2YWxpZCAoKnNlbSwgU0VNX01BR0lDKSkNDQogICAgcmV0
dXJuIEVJTlZBTDsNDQoNDQogICgqc2VtKS0+V2FpdCAoKTsNDQogIHJldHVy
biAwOw0NCn0NDQoNDQppbnQNDQpfX3NlbV90cnl3YWl0IChzZW1fdCAqIHNl
bSkNDQp7DQ0KICBpZiAoIXZlcmlmeWFibGVfb2JqZWN0X2lzdmFsaWQgKCpz
ZW0sIFNFTV9NQUdJQykpDQ0KICAgIHJldHVybiBFSU5WQUw7DQ0KDQ0KICBy
ZXR1cm4gKCpzZW0pLT5UcnlXYWl0ICgpOw0NCn0NDQoNDQppbnQNDQpfX3Nl
bV9wb3N0IChzZW1fdCAqIHNlbSkNDQp7DQ0KICBpZiAoIXZlcmlmeWFibGVf
b2JqZWN0X2lzdmFsaWQgKCpzZW0sIFNFTV9NQUdJQykpDQ0KICAgIHJldHVy
biBFSU5WQUw7DQ0KDQ0KICAoKnNlbSktPlBvc3QgKCk7DQ0KICByZXR1cm4g
MDsNDQp9DQ0KDQ0KI2VuZGlmIC8vIE1UX1NBRkUNDQo=

--42006283-6672078-995055028=:6237
Content-Type: text/plain; charset=us-ascii

--
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/
--42006283-6672078-995055028=:6237--

- Raw text -


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