Charles-Francois Natali <neolo...@free.fr> added the comment:

> Are you sure of that? I don't see how Python behaviour would be different to 
> a the same program written in C. Could you write a short example written in C 
> to prove that?

I also found this surprising, so I wroke a quick C program to test this (see 
attached C code), and as expected, calling close() from the main thread 
_doesn't_ result in recv() returning (and the socket still shows up in a 
"netstat -A inet -a").

Furthermore, closing a socket still in use by another thread is probably quite 
questionable, and close(2) man page makes it clear:
"It  is  probably  unwise to close file descriptors while they may be in use by
system calls in other threads in the same process.  Since a file descriptor
may be re-used, there are some obscure race conditions that may cause
unintended side effects."

So I'd suggest to close this issue.

----------
nosy: +neologix
Added file: http://bugs.python.org/file19012/test_socket.c

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8831>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to