示例#1
0
 def runInThread(self):
     """Run the broadcast server loop in its own thread. This is mainly for Jython,
     which has problems with multiplexing it using select() with the Name server itself."""
     thread=Thread(target=self.__requestLoop)
     thread.setDaemon(True)
     thread.start()
     log.debug("broadcast server loop running in own thread")
示例#2
0
def main():
    global abort
    daemon = Pyro4.Daemon()
    server = Pyro4.Proxy("PYRONAME:example.deadlock")

    bounceObj = bouncer.Bouncer("Client")
    daemon.register(bounceObj)  # callback object

    # register callback on the server
    server.register(bounceObj)
    # Now register server as 'callback' on the bounce object in this client
    # note: we're using the same proxy here as the main program!
    # This is the main cause of the deadlock, because this proxy will already
    # be engaged in a call when the callback object here wants to use it as well.
    # One solution could be to use a new proxy from inside the callback object, like this:
    #   server2 = server.__copy__()
    #   bounceObj.register(server2)
    bounceObj.register(server)

    # create a thread that handles callback requests
    thread = Thread(target=PyroLoop, args=(daemon,))
    thread.setDaemon(True)
    thread.start()

    print("This bounce example will deadlock!")
    print("Read the source or Readme.txt for more info why this is the case!")

    print("Calling server...")
    result = server.process(["hello"])
    print("Result=", result)  # <--- you will never see this, it will deadlock in the previous call
示例#3
0
 def runInThread(self):
     """Run the broadcast server loop in its own thread."""
     thread = Thread(target=self.__requestLoop)
     thread.setDaemon(True)
     thread.start()
     log.debug("broadcast server loop running in own thread")
     return thread
示例#4
0
 def runInThread(self):
     """Run the broadcast server loop in its own thread. This is mainly for Jython,
     which has problems with multiplexing it using select() with the Name server itself."""
     thread = Thread(target=self.__requestLoop)
     thread.setDaemon(True)
     thread.start()
     log.debug("broadcast server loop running in own thread")
示例#5
0
 def runInThread(self):
     """Run the broadcast server loop in its own thread."""
     thread = Thread(target=self.__requestLoop)
     thread.setDaemon(True)
     thread.start()
     log.debug("broadcast server loop running in own thread")
     return thread
示例#6
0
文件: client.py 项目: dwcharp/CS_550
def main():
    global abort
    daemon = Pyro4.Daemon()
    server = Pyro4.Proxy("PYRONAME:example.deadlock")

    bounceObj = bouncer.Bouncer("Client")
    daemon.register(bounceObj)  # callback objece

    # register callback obj on theserver
    server.register(bounceObj)
    # register server as 'callback' on the bounce object in this client
    # note: we're using the same proxy here as the main program!
    # This is the main cause of the deadlock, because this proxy will already
    # be engaged in a call when the callback object here wants to use it as well.
    # One solution could be to use a new proxy from inside the callback object, like this:
    #   server2 = server.__copy__()
    #   bounceObj.register(server2)
    bounceObj.register(server)

    # create a thread that handles callback requests
    thread = Thread(target=PyroLoop, args=(daemon, ))
    thread.setDaemon(True)
    thread.start()

    print("This bounce example will deadlock!")
    print("Read the source or Readme.txt for more info why this is the case!")

    print("Calling server...")
    result = server.process(["hello"])
    print(
        "Result=", result
    )  # <--- you will never see this, it will deadlock in the previous call