Skip to content

Commit

Permalink
fcntl(fd, O_NONBLOCK) => os.set_blocking(fd, False)
Browse files Browse the repository at this point in the history
  • Loading branch information
pajod committed May 12, 2024
1 parent dae6659 commit cb01bf1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions gunicorn/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ast
import email.utils
import errno
import fcntl
import html
import importlib
import inspect
Expand Down Expand Up @@ -263,8 +262,10 @@ def close_on_exec(fd):


def set_non_blocking(fd):
flags = fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK
fcntl.fcntl(fd, fcntl.F_SETFL, flags)
# available since Python 3.5, equivalent to either:
# ioctl(fd, FIONBIO)
# fcntl(fd, fcntl.F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK)
os.set_blocking(fd, False)


def close(sock):
Expand Down

0 comments on commit cb01bf1

Please sign in to comment.