Rutger ter Borg
2009-08-21 13:51:13 UTC
Dear all,
Suppose I would like to implement time-prioritized handlers for serialized
execution, that have to run through an ordinary io_service. A strand-like
interface to priority queues based would be desired,
io_service.run();
...
io_service.post( prio.push( 1, ... ) )
io_service.post( prio.push( 0, ... ) )
io_service.post( prio.push( 2, ... ) )
// runs 0 // e.g., from low to high
// runs 1
// runs 2
In terms of interface and functionality, I'm looking for a combination of a
strand and a priority queue. I have looked in detail at the prioritized
handler example.
Given that example, insertion into the priority queue is delayed up to the
point of invocation. I guess for my example this would be too late --
execution priority should be determined at the point of "wrapping",
shouldn't it (otherwise you don't know if you have to wait during
invocation)? To use the terminology of the example, somehow the priority
ordering should be shared between all wrapped_handlers and queued_handlers.
Then, when invoking, run all queued_handlers as long as they have higher
priority than any other handler. Something like this?
How to build a container (prio queue) for unbound handlers? ... Is this a
matter of a whole bunch of deadline timers? Looks like that storage of
unbound handlers is a recurring theme for me :-)
Thanks in advance for any suggestion,
Cheers,
Rutger
Suppose I would like to implement time-prioritized handlers for serialized
execution, that have to run through an ordinary io_service. A strand-like
interface to priority queues based would be desired,
io_service.run();
...
io_service.post( prio.push( 1, ... ) )
io_service.post( prio.push( 0, ... ) )
io_service.post( prio.push( 2, ... ) )
// runs 0 // e.g., from low to high
// runs 1
// runs 2
In terms of interface and functionality, I'm looking for a combination of a
strand and a priority queue. I have looked in detail at the prioritized
handler example.
Given that example, insertion into the priority queue is delayed up to the
point of invocation. I guess for my example this would be too late --
execution priority should be determined at the point of "wrapping",
shouldn't it (otherwise you don't know if you have to wait during
invocation)? To use the terminology of the example, somehow the priority
ordering should be shared between all wrapped_handlers and queued_handlers.
Then, when invoking, run all queued_handlers as long as they have higher
priority than any other handler. Something like this?
How to build a container (prio queue) for unbound handlers? ... Is this a
matter of a whole bunch of deadline timers? Looks like that storage of
unbound handlers is a recurring theme for me :-)
Thanks in advance for any suggestion,
Cheers,
Rutger