def _validate(self):
"""Raise exception if this handle is closed or not registered to be
used in the current process.
Intended to be called before every operation on `self._fd`.
Reveals wrong usage of this module in the context of multiple
processes. Might prevent tedious debugging sessions. Has little
performance impact.
"""
if self._closed:
raise GIPCClosed(
"GIPCHandle has been closed before.")
if os.getpid() != self._legit_pid:
raise GIPCError(
"GIPCHandle %s not registered for current process %s." % (
self, os.getpid()))
评论列表
文章目录