* Closing a socket
@ 2002-07-18 16:36 Kevin Curtis
2002-07-18 18:01 ` James Stevenson
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Curtis @ 2002-07-18 16:36 UTC (permalink / raw)
To: linux-kernel
Hi,
I have implemented a new socket address family and have noted that
from a multi-threaded application, if a thread calls close(fd) while a
second thread has a blocking read outstanding, the sockets release() is not
called. Is this correct? How can one unblock the read in order to do the
close.
Thanks
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Closing a socket
2002-07-18 16:36 Closing a socket Kevin Curtis
@ 2002-07-18 18:01 ` James Stevenson
2002-07-18 19:50 ` Maksim (Max) Krasnyanskiy
0 siblings, 1 reply; 3+ messages in thread
From: James Stevenson @ 2002-07-18 18:01 UTC (permalink / raw)
To: Kevin Curtis, linux-kernel
Hi
either use non-blocking sockets
or send a signal to the other process
to make it exit from the read.
> I have implemented a new socket address family and have noted that
> from a multi-threaded application, if a thread calls close(fd) while a
> second thread has a blocking read outstanding, the sockets release() is
not
> called. Is this correct? How can one unblock the read in order to do the
> close.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Closing a socket
2002-07-18 18:01 ` James Stevenson
@ 2002-07-18 19:50 ` Maksim (Max) Krasnyanskiy
0 siblings, 0 replies; 3+ messages in thread
From: Maksim (Max) Krasnyanskiy @ 2002-07-18 19:50 UTC (permalink / raw)
To: James Stevenson, Kevin Curtis, linux-kernel
> > I have implemented a new socket address family and have noted that
> > from a multi-threaded application, if a thread calls close(fd) while a
> > second thread has a blocking read outstanding, the sockets release() is not
> > called. Is this correct? How can one unblock the read in order to do the
> > close.
You might want to implement shutdown(). Thread #1 will call shutdown()
instead of
the close(). Your shutdown() implementation can do something like:
sk->shutdown |= RCV_SHUTDOWN;
sk->state_change(sk);
So, reader will wakeup, check shutdown mask and return error because socket was
shut down.
Max
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-07-18 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-18 16:36 Closing a socket Kevin Curtis
2002-07-18 18:01 ` James Stevenson
2002-07-18 19:50 ` Maksim (Max) Krasnyanskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®