This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Perl threads and UNIX sockets


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]