[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: should accept be protected with fport_wait_for_input?
From: |
Marco Maggi |
Subject: |
Re: should accept be protected with fport_wait_for_input? |
Date: |
Tue, 4 Dec 2007 07:55:00 +0100 |
Ciao,
"dskr" wrote:
>Should this protection be extended to 'accept' in the socket
>code to prevent the entire runtime from blocking if a thread
>blocks on accept?
I am not an expert in networking, but it seems to me that to
avoid blocking you need to make the server socket non-blocking.
I dunno what is you platform, but if you are using the
GNU C Library you can read the "accept" info node:
The `accept' function waits if there are no connections
pending,
unless the socket SOCKET has nonblocking mode set.
(You can use
`select' to wait for a pending connection, with a
nonblocking
socket.) *Note File Status Flags::, for information about
nonblocking mode.
HTH
--
Marco Maggi
"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"