本文整理匯總了Python中gunicorn.util.close_on_exec方法的典型用法代碼示例。如果您正苦於以下問題:Python util.close_on_exec方法的具體用法?Python util.close_on_exec怎麽用?Python util.close_on_exec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gunicorn.util
的用法示例。
在下文中一共展示了util.close_on_exec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: init_signals
# 需要導入模塊: from gunicorn import util [as 別名]
# 或者: from gunicorn.util import close_on_exec [as 別名]
def init_signals(self):
"""\
Initialize master signal handling. Most of the signals
are queued. Child signals only wake up the master.
"""
# close old PIPE
if self.PIPE:
[os.close(p) for p in self.PIPE]
# initialize the pipe
self.PIPE = pair = os.pipe()
for p in pair:
util.set_non_blocking(p)
util.close_on_exec(p)
self.log.close_on_exec()
# initialize all signals
[signal.signal(s, self.signal) for s in self.SIGNALS]
signal.signal(signal.SIGCHLD, self.handle_chld)
示例2: close_on_exec
# 需要導入模塊: from gunicorn import util [as 別名]
# 或者: from gunicorn.util import close_on_exec [as 別名]
def close_on_exec(self):
for log in loggers():
for handler in log.handlers:
if isinstance(handler, logging.FileHandler):
handler.acquire()
try:
if handler.stream:
util.close_on_exec(handler.stream.fileno())
finally:
handler.release()
示例3: accept
# 需要導入模塊: from gunicorn import util [as 別名]
# 或者: from gunicorn.util import close_on_exec [as 別名]
def accept(self, listener):
client, addr = listener.accept()
client.setblocking(1)
util.close_on_exec(client)
self.handle(listener, client, addr)