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: Possible issue with mutexes Date: Wed, 10 Apr 2019 04:57:28 +0200 Message-ID: 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="111910"; 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 04:58:14 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 1hE3RB-000SvJ-68 for ged-emacs-devel@m.gmane.org; Wed, 10 Apr 2019 04:58:14 +0200 Original-Received: from localhost ([127.0.0.1]:52533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hE3RA-0008CE-2k for ged-emacs-devel@m.gmane.org; Tue, 09 Apr 2019 22:58:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hE3Qb-0008Bv-Ss for emacs-devel@gnu.org; Tue, 09 Apr 2019 22:57:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hE3Qa-0005jI-R4 for emacs-devel@gnu.org; Tue, 09 Apr 2019 22:57:33 -0400 Original-Received: from artox.bendlas.net ([95.183.52.41]:44542 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 1hE3Qa-0005VI-E8 for emacs-devel@gnu.org; Tue, 09 Apr 2019 22:57:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bendlas.net; s=mail; t=1554865257; bh=CoeUq14eTQExFbDXA2EqXLuzNqBYyQXPfDzXFVWM1ek=; h=To:From:Subject:Date; b=bNzCOMFTkwFFrRKVmQ8//PS81J9IPc6uMUKaOHhQTomww2mCGTyxhZ24i10budZM0 eHEBRC2YxeuoFbw+BkA3wJPr3/QGnfG8sppjJU99JAElUb9GTlMDafQasfaqfQKugf SW4Uj1RLGxevx+7VVXxKQDSd5EHDb6rswwXIZVWs= 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:235188 Archived-At: 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