X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=Baz6pE+83T7YLBkM1kkLFvNzH17l5GZFiXX/rg0KSbcFpLU9aGWYT fEFrqfFu2NyIxhlK3SaA9IEld3S4g7fHnPXriN5WaTMl9egWpX3IfG41aMPZpem2 0n7hrFJjzHsGA+wxa92lJpjdnHbahUzFbVkrLpHwL+MnCqaXXKsWWc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=wLwM2j2DybbvHn5Ut2rVC66q7kA=; b=x0Gjg9OUg9DcYRLOJzoPv6uLW/++ BWdjO6ktu/3klfwdvW9eE0hajaA2sNVpkoCpqDokt90uZbejhO40QTFsp1J9AODz QcFcKUnTIW7bfXlR0j9LneQz8QdugWh3dOSzhbnx3Ga6StLYSX0A6Je3hiURzu7O AzcC8Qm+3667mdg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=hundred, flight, millions, highly X-HELO: drew.franken.de X-Spam-Score: -2.9 Date: Wed, 14 Feb 2018 15:30:48 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: mixed usage of lock protection and lock-free List template class in thread.h Message-ID: <20180214143048.GH30794@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <1543396632 DOT 5417641 DOT 1512146709346 DOT ref AT mail DOT yahoo DOT com> <1543396632 DOT 5417641 DOT 1512146709346 AT mail DOT yahoo DOT com> <20171201171536 DOT GA4325 AT calimero DOT vinschen DOT de> <1264797847 DOT 540865 DOT 1518590850864 AT mail DOT yahoo DOT com> <1460534026 DOT 545542 DOT 1518591843449 AT mail DOT yahoo DOT com> <1541824013 DOT 551552 DOT 1518593858391 AT mail DOT yahoo DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="aBaYPhOdNx+t7mr3" Content-Disposition: inline In-Reply-To: <1541824013.551552.1518593858391@mail.yahoo.com> User-Agent: Mutt/1.9.1 (2017-09-22) --aBaYPhOdNx+t7mr3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Feb 14 07:37, Xiaofeng Liu via cygwin wrote: > Sorry, I need send again for another try for the formatting. >=20 >=20 > (Yahoo deleted my spaces. Please reformat the code in your C++ editor > if you want to use the code. Sorry!) You may want to use a good old MUA like thunderbird or mutt :} > Here is the sample code that will hang in cygwin: test-thread.cpp > to compile:=20 > g++ -std=3Dc++0x test-thread.cpp -lpthread=20 > In this code, mutex and cond need be created and destroyed very > frequently, which could corrupt the static list object owned by some > classes in thread.h. In my test, I have a computer of 8 threads to run > cygwin, and the hang could happen when cond/mutex objects are created > and destroyed for the order of 1 millions times within a few minutes. > Is this practical? Yes. My code for my product used a lot of > std::future which use one mutex and one mutex for each object. The > future objects are created and destroyed on the flight, so are for > mutex and cond variables. I can also observe that the peak memory > kept increasing to a few hundred MB, and I suspect there is a MEMORY > LEAK in cygwin kernel.=20 > I hope the format will be good. If not, I will try again. The leading spaces are still gone but at least the linefeeds have been retained, so all is good. Note that this is not sufficient for patch submissions. Make sure to send them as attachment as long as you're using a broken MUA. Thanks for the example. If you can come up with a patch for a lockless implementation this would be highly appreciated. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --aBaYPhOdNx+t7mr3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlqESBgACgkQ9TYGna5E T6BxPw/+OR7xYRopshqSagl4ppXEjzrcO3C8oQQYk7Vfogl2eoIsIrSgwkOMuytc bk8Ib3MUTCJReB279MBmR6eCgwpdpcirMm+xUInTVsvciBVkOMfjEW19blQMSzS8 GXF5qAiZOBy2oYHSv2OUmHJeG+sPLQ4r5QxqY7NESz9dGC4lZKXRbdld9EeNWWvB UiY7ZJJSFy5mm3y8zv4xIOPJmfuwktb9JOF1PWyFrQdZQXbVXmvbbNnYFyoHeb8J hguO6U3mjW0KoIZ35ipm0lQtB6LxH+1qxGVFE6PwBSbtPbco7KTgoIlmA1RrHTDq HBO9NxRgCpxaFgWZMZD4BjIpCXwdFYq5eudIiHFt/sLM1ElNiX0cHyVcu/fS4izz 1tk9nFsyqdf/8fIyjno2xj/mnxKnPFAbNx/FInW4RVRiOXeFf+9JmxfurLKy0rbl 0wnYRRgIF7BbcrCLAIOsYO1vdY6RWt/5i/FJchmJsGRMeDoP1LEpUll3qUyjpqXd KNgLyVnDIYgQxhAXueRaf6vFv/k0+CJt/mq8AQy60ajA0SSAy6JKe91bqQEPVqbW cJaOpvav3fDdlu7TY877D1X2/x6I0M20PW2kcO/lSpajm9nHNI27tnCf+M+umZva DosFj3rrSdVGfe4tGvNk5sAKmnRsvo5R9fxD45WPY/elElyuUzU= =Mlc5 -----END PGP SIGNATURE----- --aBaYPhOdNx+t7mr3--