Made async fds nonblocking.
This commit is contained in:
parent
402dc20e1f
commit
43a2b6a2a5
|
@ -96,12 +96,14 @@ HANDLER_DEF(ASYNC_sigio) {
|
|||
* Makes the passed filedescriptor async (or not) depending on flag.
|
||||
*/
|
||||
static BOOL ASYNC_MakeFDAsync(int unixfd,int async) {
|
||||
int flags;
|
||||
|
||||
#if !defined(FASYNC) && defined(FIOASYNC)
|
||||
#define FASYNC FIOASYNC
|
||||
#endif
|
||||
|
||||
#ifdef FASYNC
|
||||
int flags;
|
||||
#endif
|
||||
|
||||
#ifdef F_SETOWN
|
||||
if (-1==fcntl(unixfd,F_SETOWN,getpid()))
|
||||
perror("fcntl F_SETOWN <pid>");
|
||||
|
@ -112,9 +114,9 @@ static BOOL ASYNC_MakeFDAsync(int unixfd,int async) {
|
|||
return FALSE;
|
||||
}
|
||||
if (async)
|
||||
flags|=FASYNC;
|
||||
flags|=FASYNC | O_NONBLOCK;
|
||||
else
|
||||
flags&=~FASYNC;
|
||||
flags&=~(FASYNC | O_NONBLOCK);
|
||||
if (-1==fcntl(unixfd,F_SETFL,&flags)) {
|
||||
perror("fcntl F_SETFL FASYNC");
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in New Issue