delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/06/02/05:10:50

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Tue, 2 Jun 2009 11:10:31 +0200
Message-ID: <9bfd07db0906020210h57d4c12h62f47a6ba3a5730e@mail.gmail.com>
Subject: [1.7] pthread_create block
From: Thomas Stalder <cygwinml AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

--001636c5a501212c9d046b59ea3e
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello,

Sometimes pthread_create block and never return.

I have made a simple program (test.c) to reproduce the problem.

> gcc test.c -lpthread -o test
> ./test
thread id=1
thread id=2
thread id=3
thread id=4
........
thread id=3736


Sometimes pthread_create block after creating arround 10 threads,
sometimes after creating arround 10000 threads or more.

The test program work well under linux.

--
Thomas

--001636c5a501212c9d046b59ea3e
Content-Type: text/plain; charset=US-ASCII; name="test.c"
Content-Disposition: attachment; filename="test.c"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fvge1rwr0

I2luY2x1ZGUgPHN0ZGlvLmg+IAojaW5jbHVkZSA8c3RkbGliLmg+IAojaW5j
bHVkZSA8cHRocmVhZC5oPgojaW5jbHVkZSA8dW5pc3RkLmg+CgoKc3RhdGlj
IHB0aHJlYWRfbXV0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WQgd2l0aCBv
dXIgYXR0cmlidXRlICovCi8vCQlwcmludGYoImJlZm9yZSBwdGhyZWFkX2Ny
ZWF0ZVxuIik7CgkJZXJyID0gcHRocmVhZF9jcmVhdGUoJnRocmVhZF9pZCwg
JmF0dHIsIHRocmVhZF9mdW5jLCBOVUxMKTsKCQlpZiAoZXJyKQoJCXsKCQkJ
cHJpbnRmKCJwdGhyZWFkX2NyZWF0ZSBlcnJvclxuIik7CgkJfQkKLy8JCXBy
aW50ZigiYWZ0ZXIgcHRocmVhZF9jcmVhdGVcbiIpOwoJCXB0aHJlYWRfYXR0
cl9kZXN0cm95KCZhdHRyKTsKCX0KfQo=


--001636c5a501212c9d046b59ea3e
Content-Type: text/plain; charset=us-ascii

--
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/
--001636c5a501212c9d046b59ea3e--

- Raw text -


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