From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127705 invoked by alias); 14 Feb 2018 14:30:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 127565 invoked by uid 89); 14 Feb 2018 14:30:53 -0000 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 Received: from mail-n.franken.de (HELO drew.franken.de) (193.175.24.27) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 14 Feb 2018 14:30:52 +0000 Received: from perth.hirmke.de (aquarius.franken.de [193.175.24.89]) by mail-n.franken.de (Postfix) with ESMTP id AED92721E280C for ; Wed, 14 Feb 2018 15:30:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by perth.hirmke.de (Postfix) with ESMTP id 887278623F2 for ; Wed, 14 Feb 2018 15:30:49 +0100 (CET) X-Spam-Score: -2.9 Received: from perth.hirmke.de ([127.0.0.1]) by localhost (perth.hirmke.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id VxWXYR2E2ayZ for ; Wed, 14 Feb 2018 15:30:48 +0100 (CET) Received: from calimero.vinschen.de (calimero.vinschen.de [192.168.129.6]) by perth.hirmke.de (Postfix) with ESMTP id A4F96862388 for ; Wed, 14 Feb 2018 15:30:48 +0100 (CET) Received: by calimero.vinschen.de (Postfix, from userid 500) id 9C3BAA80554; Wed, 14 Feb 2018 15:30:48 +0100 (CET) Date: Wed, 14 Feb 2018 14:30:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.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@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <1543396632.5417641.1512146709346.ref@mail.yahoo.com> <1543396632.5417641.1512146709346@mail.yahoo.com> <20171201171536.GA4325@calimero.vinschen.de> <1264797847.540865.1518590850864@mail.yahoo.com> <1460534026.545542.1518591843449@mail.yahoo.com> <1541824013.551552.1518593858391@mail.yahoo.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) X-SW-Source: 2018-02/txt/msg00163.txt.bz2 --aBaYPhOdNx+t7mr3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1731 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" Content-length: 833 -----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--