delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/28/12:53:56

X-Spam-Check-By: sourceware.org
X-YMail-OSG: s4rZVz0VM1l5YN15ULvwJZAn5m0WrSx3FgleOYHCAnj2xJqFOGxFDIUjBe0jMeoZYazv_ZQ8Kv9yMDwcomJX0dqa8stZK0xlIrezZhF4JwBAkO5SWq_cdPqkEfxIuw9qNOqF4vRFsqfR
Message-ID: <45BCE2AE.5090504@yahoo.de>
Date: Sun, 28 Jan 2007 18:51:42 +0100
From: Sebastian Weber <webersebastian AT yahoo DOT de>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Perl threads and UNIX sockets
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

Hi all,

I found a problem in the current cygwin perl (v5.8.7 built for 
cygwin-thread-multi-64int): The following code sets up a UNIX domain 
socket server and connects to that server in a different thread. It will 
block forever exactly at the connect / accept calls:

#!/usr/bin/perl
use threads;
use Socket;

unlink ("/tmp/mysock");
$t=threads->create("con_thread");

socket (SOCK1,PF_UNIX,SOCK_STREAM,0) or die "socket(): $!";
bind (SOCK1, sockaddr_un("/tmp/mysock")) or die "bind(): $!";
listen(SOCK1,SOMAXCONN) or die "listen(): $!";
accept (CLIENT,SOCK1);
$t->join();

sub con_thread {
    sleep(2);
    socket(SOCK2, PF_UNIX, SOCK_STREAM, 0) or die "socket(): $!";
    connect(SOCK2, sockaddr_un("/tmp/mysock")) or die "connect(): $!";
}

This code will _not_ block using perl v5.8.7 on Linux or HPUX. Is this a 
bug? Is there a workaround?

Greets, Sebastian


		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de

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

- Raw text -


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