Wouldn't a solution then be to set the Stdio.File object back to non-blocking in the close callback?
Modified Per example 2:
for(int i=0; i<300; i++) { object q=Stdio.File(); q->connect("www.liu.se", 80); q->set_id(q); q->write("GET / HTTP/1.0\r\n\r\n"); q->set_nonblocking(lambda(){werror("data");}, lambda(){}, lambda(mixed x) { werror("closed\n"); x->set_nonblocking(); }); }
<lots of data/closed>
sizeof(Stdio.get_all_active_fd());
(4) Result: 11
Maybe we even want to introduce some way of letting the Stdio.File object go back to nonblocking upon close? Either as a default or as a flag in set_nonblocking or by some other method.