On Wed, 03 Jun 2015 12:42:28 +0200, Grzegorz Dwornicki said:

> Server callend the recv function and waits for the data from client
> soo its blocked in wait_queue. The socket is in nonblocking state. Can
> this proces/thread be unblocked on demand?

Umm... according to the manpage for 'man 2 recv':

       If no messages are available at the socket, the receive calls  wait  for 
 a  message  to  arrive,
       unless  the  socket is nonblocking (see fcntl(2)), in which case the 
value -1 is returned and the
       external variable errno is set to EAGAIN or EWOULDBLOCK.  The receive 
calls normally  return  any
       data  available,  up  to the requested amount, rather than waiting for 
receipt of the full amount
       requested.

So if the socket really *is* nonblocking, I'm not seeing how it would end
up blocked.  If it sits in that state for long enough, you might want to do
a 'cat /proc/NNN/stack' to see where in the kernel it is.

But first, I'd double check that the socket is in fact non-blocking. Did
you remember to do something like this:

    rc = socket(AF_INET,SOCK_whatever|SOCK_NONBLOCK,protocol);
    if (rc < 0) { /* whine about failure */ };

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to