[libvirt] [PATCH v2 1/2] timer impl
Hu Tao
hutao at cn.fujitsu.com
Fri Dec 17 09:24:53 UTC 2010
On Wed, Dec 15, 2010 at 03:32:26PM +0000, Daniel P. Berrange wrote:
> On Wed, Dec 15, 2010 at 08:24:44AM -0700, Eric Blake wrote:
> > On 12/15/2010 08:20 AM, Eric Blake wrote:
> > > On 12/14/2010 07:34 PM, Wen Congyang wrote:
> > >
> > > In addition to Hu's comments, and the fact that you are probably going
> > > to revise the exposed interface anyways, here's some additional points.
> >
> > One other point - how does this relate to the timeouts already
> > implemented in places like daemon/event.c or src/util/event.c? Are
> > those implementations already sufficient for your needs without having
> > to write a new implementation? Or conversely, should your patch series
> > be lengthened into rewriting those interfaces to take advantage of your
> > new implementation in order to ease maintenance by focusing all timeout
> > code into a single reusable interface? In other words, I'm still
> > seeking a bit more justification for this patch.
>
> IMHO it should be sufficient for this new code to simply call
> the existing virEventAddTimeout() API, and run the event loop
> in the background thread.
But wouldn't it be a better idea to implement new timer APIs that focus
only on timeout? I think it will make the code more modular and easier
to maintain&improve.
Althouth the virEventAddTimeout() API works well, but it has several
disadvantages:
- Not so easy to use: the user have to create a thread to run the event
loop
- All timers are not only serialized with each other but also with
event handlers(if there are), if there are too many timers and event
handlers it could cause performance impact.
--
Thanks,
Hu Tao
More information about the libvir-list
mailing list