Пример #1
0
def off():
    global annex_thread, target
    if annex_thread is None:
        return
    for i in range(10):
        try:
            close = target.close
        except AttributeError:
            # It may not have been initiated yet.
            # wait and repeat
            time.sleep(0.05)
        else:
            close()
            break
    else:
        raise

    heapyc.set_async_exc(annex_thread, SystemExit)

    while True:
        if not hasattr(heapyc.RootState, 't%d_async_exc' % annex_thread):
            break
        else:
            time.sleep(0.05)

    annex_thread = target = None
Пример #2
0
 def run():
     try:
         while socket is self.socket:
             line = ostdin.input.readline()
             if not line:
                 break
             if line == KEYBOARDINTERRUPT:
                 if socket is self.socket:
                     heapyc.set_async_exc(self.target.annex_thread,
                                          KeyboardInterrupt)
             else:
                 queue.put(line)
     finally:
         if socket is self.socket:
             heapyc.set_async_exc(self.target.annex_thread,
                                  SocketClosed)
Пример #3
0
 def run():
     try:
         _hiding_tag_ = self.intlocals['hp']._hiding_tag_
         while socket is self.socket:
             line = ostdin.input.readline()
             if not line:
                 break
             if line == KEYBOARDINTERRUPT:
                 if socket is self.socket:
                     heapyc.set_async_exc(self.target.annex_thread,
                                          KeyboardInterrupt)
             else:
                 queue.put(line)
     finally:
         if socket is self.socket:
             heapyc.set_async_exc(self.target.annex_thread,
                                  SocketClosed) 
Пример #4
0
def off():
    global annex_thread, target
    if annex_thread is None:
	return 
    for i in range(10):
	try:
	    close = target.close
	except AttributeError:
	    # It may not have been initiated yet.
	    # wait and repeat
	    print 'Can not turn it off yet, waiting..'
	    time.sleep(1)
	else:
	    close()
	    break
    else:
	raise
	
    heapyc.set_async_exc(annex_thread, SystemExit)
    annex_thread = target = None