Вопрос

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