txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00006
Re: Sending from a for loop
Hey Esteve,
I do not think you can just use callFromThread alone, I believe you
have to use callInThread first to push the context to another thread
and than use callFromThread to access transport.write() from the
thread.
It seems the patch works only if I push my send loop to another thread:
reactor.callInThread(send_msgs_from_for_loop, channel)
The following script shows the issue:
http://pastie.org/580156
It sends 5 messages without callInThread, than 5 messages with callInThread:
send_msgs_from_for_loop(channel)
reactor.callInThread(send_msgs_from_for_loop, channel, True)
The results I see on my machine are:
sending: 1
sending: 2
sending: 3
sending: 4
sending: 5
sending: 1
receiving: 1
receiving: 2
receiving: 3
receiving: 4
receiving: 5
receiving: 1
sending: 2
receiving: 2
sending: 3
receiving: 3
sending: 4
receiving: 4
sending: 5
receiving: 5
receiving: STOP
Thanks,
Dan
Follow ups
References