[zeromq-dev] zloop_timer() does not fire if added after zloop_start()...

Andy Ballingall TF ballingall at thefoundry.co.uk
Thu Dec 27 14:53:29 CET 2012


Hi Pieter,

> Good catch. How are you adding/removing timers if not in a handler,
> though? As handlers are all finished before the next poll starts, this
> should work.

I was only adding the timer from within the handler which was called
as a result of the reactor receiving a message. I've just put the old
method back in place, and here's the result of verbose mode:

12-12-27 13:42:29 I: zloop: cancel timer
12-12-27 13:42:29 I: zloop: register timer delay=3000 times=1
12-12-27 13:42:29 I: zloop: polling for 3600000 msec
12-12-27 13:42:29 I: zloop: call PAIR socket handler (0x7fbb440008c0, 0)
12-12-27 13:42:30 I: zloop: cancel timer
12-12-27 13:42:30 I: zloop: register timer delay=6000 times=1
12-12-27 13:42:30 I: zloop: polling for 3600000 msec

Note how my timer registration succeeds, but the polling seems to
ignore it? I've just been through the code to see whether I could
inadvertently have been calling something from another thread, but I'm
pretty sure I'm not. However, let me see if I can create a test
program which exhibits this behaviour...

Andy


I've got a client and server.

1) client sets up a reactor with no timers.
2) client says hello to the server and a handler deals with the reply.
3) client does some work, and at a time of its choosing sends some
data to the server
4) server responds, and tells the client to send certain data to it
within X seconds
5) client adds a timer (in the response handler)
6) client sends a message to the timer.
4) goto 4



--
Andy Ballingall
Senior Software Engineer

The Foundry
6th Floor, The Communications Building,
48, Leicester Square,
London, WC2H 7LT, UK
Tel: +44 (0)20 7968 6828 - Fax: +44 (0)20 7930 8906
Web: http://www.thefoundry.co.uk/

The Foundry Visionmongers Ltd.
Registered in England and Wales No: 4642027



More information about the zeromq-dev mailing list