www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/05/14/05:30:41

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 54E9UdZW2310862
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 54E9UdZW2310862
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=y5m5mp8S
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CF95938560A2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1747215037;
bh=fLnH3ufUE5N8qmnIWOn9oLEGf84eZwXJ6wjkRi0LtvY=;
h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:
List-Help:List-Subscribe:From:Reply-To:From;
b=y5m5mp8S8mgP1vV1UqKLwn4cx6FZ7H/Z4hP5KTI497d23EV90Azs/5QUVRorcwk9k
kdjXc/1oyM3E870FQjlPf+SpbPfu0IgQKdtGxgRoReX/UAPIln4sSR9+KLyZdOfh5I
e+vUgUl+xSIGOKWfneVsLy/IcVdZnALMKZkOH20A=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C08B385842C
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C08B385842C
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1747214977; cv=none;
b=OYAcAS5VHHvWJW2l386WE11yNJ/5v2lAbvPFmjfTy6ugIZEK0iok+o61gOhvPO8IJA7X92/13WyeQ1BOpPIGs7Lpfr5uJvUxU3PAxCio4tE4OXbZd38YCyOi2vykdRN8/OGMjaac9jHddI2qjss2OD4gbi8WwRkf+W1nwjNXwYM=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1747214977; c=relaxed/simple;
bh=1hTFkZ7dddHNUKUjd2N6xMpGnK6Tu1/YZQofq95FyyM=;
h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
b=rtGgfvesAa4h0Y0v/7gFUiSGXjLcVs7+cRezGkw8crmShINwF8ShKH5BvI6dtBW1EmMgRM7Ic+F42lAbwbpx0W+rq+L6APEsfL+lKucHp6uYDNZcHl5TXK+8jPAsKOpaFy8cAiiVLyTj8zXLUWA+UoCFkro0+q+Xwnx5crQUGvY=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C08B385842C
Date: Wed, 14 May 2025 18:29:34 +0900
To: cygwin AT cygwin DOT com
Subject: FIFO hangs (Probably a bug of cygwin fifo)
Message-Id: <20250514182934.ee8ff6c46ecfc44c69e70b72@nifty.ne.jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Hi Ken,

I encountered the problem with fifo. The following STC hangs
in cygwin while it works in linux.

Perhaps, cygheap->fdtab.lock() causes a deadlock between
both open().

Could you please take a look?

#include <unistd.h>
#include <pthread.h>
#include <sys/stat.h>
#include <fcntl.h>

#define fifo1 "/tmp/fifo-test"

void *thr1(void *)
{
	int fd;
	usleep(100000);
	fd = open(fifo1, O_WRONLY);
	write(fd, "A", 1);
	usleep(100000);
	close(fd);
	return NULL;
}

int main()
{
	int fd;
	pthread_t th;
	char c;
	mkfifo(fifo1, 0600);
	pthread_create(&th, NULL, thr1, NULL);
	fd = open(fifo1, O_RDONLY);
	pthread_join(th, NULL);
	read(fd, &c, 1);
	write(1, &c, 1);
	close(fd);
	return 0;
}

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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