From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Herwig Hochleitner Newsgroups: gmane.emacs.devel Subject: Re: Possible issue with mutexes Date: Wed, 10 Apr 2019 05:11:36 +0200 Message-ID: <60468e7f-57a8-a263-a004-884b51461db7@bendlas.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="166651"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 10 05:12:07 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hE3ef-000h5y-Os for ged-emacs-devel@m.gmane.org; Wed, 10 Apr 2019 05:12:05 +0200 Original-Received: from localhost ([127.0.0.1]:52657 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hE3eX-0002ZX-RG for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 23:11:57 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59407) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hE3eR-0002ZM-Qc for emacs-devel@gnu.org; Tue, 09 Apr 2019 23:11:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hE3eP-0008M2-Km for emacs-devel@gnu.org; Tue, 09 Apr 2019 23:11:51 -0400 Original-Received: from artox.bendlas.net ([95.183.52.41]:44546 helo=mail.bendlas.net) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hE3eP-0007ld-9k for emacs-devel@gnu.org; Tue, 09 Apr 2019 23:11:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bendlas.net; s=mail; t=1554866104; bh=tV8c4NNWSE8kV8vvPiwa1zy2tU5xyNM3txJMdscnAs0=; h=Subject:From:To:References:Date:In-Reply-To; b=LXSwwE2CY+Hzz0YejLou4mSqihT2SkoGuTc2Mg4cwnn+mRve2YA7Qca6e8gXPkUy9 qPjGPQ5T7qczyYmkRNyYoiqy7Ggi14mZfWaa09sQEvCU+JX+s33WVVzG2ZZ4XsO8TF ci71OO9CJupieS/6ER3k32UieBKWQQTtgO/3YTZ4= In-Reply-To: Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 95.183.52.41 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235189 Archived-At: On 4/10/19 4:57 AM, Herwig Hochleitner wrote: > Hello, > > I've recently created a semaphore type, based on mutex and condition > vars, for controlling parallelism in an elisp processor. > > The project went well, so far, but now that I attempted to pull out > this semaphore implementation and create a test for it, I've noticed > behavior, that leads me to believe, that emacs' thread and mutex > guarantees might not hold in all cases. > > When running the [test > case](https://github.com/webnf/semaphore.el/blob/306d5a84b99526213c3a7d367f8d8041961ea52a/test/emacs-semaphore-test.el), > you would expect `test/semaphore/active-count` to be 0 at the end of a > run, right? For me, it's wildly inconsistent at the end of a run and > seems to become desynchronized among worker threads. In this [example > run](https://hastebin.com/wigiwizabi.log) from my machine, it happens > to settle at 10. > > Am I doing this wrong, somehow? > > If not, could somebody help me file a report? First post on this ML ... > > kind regards Argh .. found the bug in my code. Sorry for the spam! Since we are here already, let me ask you about this other issue, I had: Waiting on a condition var or joining a thread on the main thread can freeze emacs totally dead. Like kill -9 dead. Is this a known issue or should I investigate further?