Exemplo n.º 1
0
def reduce_handle(handle):
    if Popen.thread_is_spawning():
        return (None, Popen.duplicate_for_child(handle), True)
    dup_handle = duplicate(handle)
    _cache.add(dup_handle)
    sub_debug('reducing handle %d', handle)
    return (_get_listener().address, dup_handle, False)
Exemplo n.º 2
0
def reduce_handle(handle):
    if Popen.thread_is_spawning():
        return (None, Popen.duplicate_for_child(handle), True)
    dup_handle = duplicate(handle)
    _cache.add(dup_handle)
    sub_debug('reducing handle %d', handle)
    return (_get_listener().address, dup_handle, False)
Exemplo n.º 3
0
 def __init__(self, address, backlog = None):
     self._address = address
     handle = win32.CreateNamedPipe(address, win32.PIPE_ACCESS_DUPLEX, win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | win32.PIPE_WAIT, win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, win32.NMPWAIT_WAIT_FOREVER, win32.NULL)
     self._handle_queue = [handle]
     self._last_accepted = None
     sub_debug('listener created with address=%r', self._address)
     self.close = Finalize(self, PipeListener._finalize_pipe_listener, args=(self._handle_queue, self._address), exitpriority=0)
Exemplo n.º 4
0
 def __init__(self, address, backlog = None):
     self._address = address
     handle = win32.CreateNamedPipe(address, win32.PIPE_ACCESS_DUPLEX, win32.PIPE_TYPE_MESSAGE | win32.PIPE_READMODE_MESSAGE | win32.PIPE_WAIT, win32.PIPE_UNLIMITED_INSTANCES, BUFSIZE, BUFSIZE, win32.NMPWAIT_WAIT_FOREVER, win32.NULL)
     self._handle_queue = [handle]
     self._last_accepted = None
     sub_debug('listener created with address=%r', self._address)
     self.close = Finalize(self, PipeListener._finalize_pipe_listener, args=(self._handle_queue, self._address), exitpriority=0)
     return
Exemplo n.º 5
0
def rebuild_handle(pickled_data):
    address, handle, inherited = pickled_data
    if inherited:
        return handle
    sub_debug('rebuilding handle %d', handle)
    conn = Client(address, authkey=current_process().authkey)
    conn.send((handle, os.getpid()))
    new_handle = recv_handle(conn)
    conn.close()
    return new_handle
Exemplo n.º 6
0
        def __init__(self, address, backlog=None):
            self._address = address
            self._handle_queue = [self._new_handle(first=True)]

            self._last_accepted = None
            sub_debug('listener created with address=%r', self._address)
            self.close = Finalize(
                self, PipeListener._finalize_pipe_listener,
                args=(self._handle_queue, self._address), exitpriority=0
                )
Exemplo n.º 7
0
def rebuild_handle(pickled_data):
    address, handle, inherited = pickled_data
    if inherited:
        return handle
    sub_debug('rebuilding handle %d', handle)
    conn = Client(address, authkey=current_process().authkey)
    conn.send((handle, os.getpid()))
    new_handle = recv_handle(conn)
    conn.close()
    return new_handle
Exemplo n.º 8
0
        def __init__(self, address, backlog=None):
            self._address = address
            self._handle_queue = [self._new_handle(first=True)]

            self._last_accepted = None
            sub_debug('listener created with address=%r', self._address)
            self.close = Finalize(self,
                                  PipeListener._finalize_pipe_listener,
                                  args=(self._handle_queue, self._address),
                                  exitpriority=0)
Exemplo n.º 9
0
 def __call__(self, *args, **kwargs):
     '''
     Run the callback unless it has already been called or cancelled
     '''
     if self._pid != os.getpid():
         util.sub_debug('finalizer ignored because different process')
         self._weakref = self._callback = self._args = \
             self._kwargs = self._key = None
         return None
     else:
         return UnpatchedFinalize.__call__(self, *args, **kwargs)
Exemplo n.º 10
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)
Exemplo n.º 11
0
 def _finalize_pipe_listener(queue, address):
     sub_debug('closing listener with address=%r', address)
     for handle in queue:
         close(handle)