예제 #1
0
 def process_request(self, request, client_address):
     """Start a new thread to process the request."""
     t = threading.Thread(
         target=self.process_request_thread,  # @UndefinedVariable
         args=(request, client_address))
     t.daemon = self.daemon_threads
     t.start()
예제 #2
0
from _pydev_imps._pydev_saved_modules import threading

# Hack for https://sw-brainwy.rhcloud.com/tracker/PyDev/363 (i.e.: calling isAlive() can throw AssertionError under some circumstances)
# It is required to debug threads started by start_new_thread in Python 3.4
_temp = threading.Thread()
if hasattr(_temp, '_is_stopped'):  # Python 3.4 has this

    def is_thread_alive(t):
        try:
            return not t._is_stopped
        except:
            return t.isAlive()

elif hasattr(_temp, '_Thread__stopped'):  # Python 2.7 has this

    def is_thread_alive(t):
        try:
            return not t._Thread__stopped
        except:
            return t.isAlive()

else:  # Haven't checked all other versions, so, let's use the regular isAlive call in this case.

    def is_thread_alive(t):
        return t.isAlive()


del _temp
예제 #3
0
    del sys.argv[0]

    from _pydev_bundle import pydev_localhost

    if int(port) == 0 and int(client_port) == 0:
        (h, p) = pydev_localhost.get_socket_name()

        client_port = p

    host = pydev_localhost.get_localhost()

    #replace exit (see comments on method)
    #note that this does not work in jython!!! (sys method can't be replaced).
    sys.exit = do_exit

    interpreter = InterpreterInterface(host, int(client_port),
                                       threading.currentThread())

    server_thread = threading.Thread(target=start_console_server,
                                     name='ServerThread',
                                     args=(host, int(port), interpreter))
    server_thread.setDaemon(True)
    server_thread.start()

    sys.stdin = StdIn(interpreter, host, client_port, sys.stdin)

    globals = run_file(file, None, None)

    interpreter.get_namespace().update(globals)

    process_exec_queue(interpreter)