delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/03/22:07:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00
X-Spam-Check-By: sourceware.org
Message-ID: <568419.8347.qm@web25006.mail.ukl.yahoo.com>
Date: Wed, 4 Mar 2009 03:07:13 +0000 (GMT)
From: Marco Atzeri <marco_atzeri AT yahoo DOT it>
Reply-To: marco_atzeri AT yahoo DOT it
Subject: R: Cygwin PThreads bug?
To: cygwin AT cygwin DOT com, Nicholas Sherlock <n DOT sherlock AT gmail DOT com>
In-Reply-To: <gokli9$s59$1@ger.gmane.org>
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--- Mer 4/3/09, Nicholas Sherlock  ha scritto:

> Da: Nicholas Sherlock=20
> Oggetto: Cygwin PThreads bug?
> A: cygwin AT cygwin DOT com
> Data: Mercoled=EC 4 marzo 2009, 02:29
> Hey everyone,
>=20
> I'm writing a very thread-intensive application using
> Cygwin and Cygwin's PThreads implementation, and I'm
> running into a few problems. As far as I can tell from the
> spec:
>=20
> http://www.opengroup.org/onlinepubs/000095399/functions/pthread_rwlock_rd=
lock.html
>=20
> This C program:
>=20
> #include <stdio.h>
> #include <pthread.h>
> #include <assert.h>
> #include <errno.h>
>=20
> int main() {
> 	pthread_rwlock_t rw_lock;
>=20
> 	pthread_rwlock_init(&rw_lock,NULL);
>=20
> 	//Lock it once for read...
> 	assert(pthread_rwlock_rdlock(&rw_lock)=3D=3D0);
>=20=09
> 	//Lock it again for read...
> 	int err=3Dpthread_rwlock_rdlock(&rw_lock);
>=20
> 	printf("Err %d\n", err);
>=20
> 	assert (err=3D=3DEAGAIN || err=3D=3D0);
>=20
> 	if (err!=3DEAGAIN)
> 	  pthread_rwlock_unlock(&rw_lock);
>=20
> 	pthread_rwlock_unlock(&rw_lock);
>=20
> 	pthread_rwlock_destroy(&rw_lock);
>=20=09
> 	return 0;
> }
>=20
> Should run correctly. That is, the second call to
> pthread_rwlock_rdlock should either succeed (returning
> zero), having acquired the read lock a second time, or it
> should fail and return EAGAIN, if the number of simultaneous
> allowed read locks has been exceeded. It should not fail and
> return EDEADLK (45), which it is currently doing. Am I
> reading the spec wrong or is Cygwin non-conforming?
>=20
> Cheers,
> Nicholas Sherlock
>=20
>=20
Hi Nicholas,

on=20
$ uname -a
CYGWIN_NT-5.1 ITQMOZCAS2NB007 1.7.0(0.200/5/3) 2009-02-20 17:20 i686 Cygwin

compiled with gcc-4

$ ./pthread.exe=20
Err 0


Regards
Marco


      Passa a Yahoo! Mail.

La webmail che ti offre GRATIS spazio illimitato,=20
antispam e messenger integrato.
http://it.mail.yahoo.com/=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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