質問

My object:

class mysrv(object):
    def __init__(self):
        self._pubsocket = context.socket(zmq.PUB)
        self._socket = context.socket(zmq.REP)
        self._socket.bind("tcp://127.0.0.1:9003")
        self._pubsocket.bind("tcp://127.0.0.1:9004")

Then I run both functions:

def main():
    s = mysrv()
    Process(target=s.publoop()).start()
    Process(target=s.reqrep()).start()

The first function blocks the second. Is there any way to run them from a single class instance?

役に立ちましたか?

解決

The answer is that while will block everything even sleep is called.

So, running many whiles in the same process without breaks is blocking.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top