[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Event priorities
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Event priorities
- From: Vincent Bernat <bernat@xxxxxxxx>
- Date: Mon, 30 Apr 2012 22:06:48 +0200
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Mon, 30 Apr 2012 16:07:01 -0400
- Dkim-signature: v=1; a=rsa-sha1; c=simple; d=luffy.cx; h=from:to:subject :in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=postfix; bh=jDZqFgqwV d7yjEkGnyNGmZSkXH4=; b=Fmh1o7igQ0XWIYZHPm6CNIlCpoiNlDh2nyg0I03uw QE2TAKq3Xp6s2B9BbFPlSHwag0iNRvC/jMLUklBxUllna8wO0XYxEB3qU+WVujy9 iUfqkodfLn67iFP7b+kd1AQ6/7d26JUE+b1VJhyI9bX2zB4uK7DG12X8BpM4Q00h vM=
- Domainkey-signature: a=rsa-sha1; c=simple; d=luffy.cx; h=from:to:subject :in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=postfix; b=l94 6YsA8WKP+vemN7aXEVkm3fTBpCoD5cEM4CBlZj+sgM6amiN9/+feCQeGzcosSUt0 jpqVNk9p2S3iV2fIt/k36DmVe/0JxaUJAlClaXiRjB3Wzga26FCdN/y/Br0lImNj +uAf61Ogjq8Vg+HO/+aBwDrupVXN2VVw+d+P0skQ=
- In-reply-to: <912123A6-4633-4462-AD88-1400FDF93895@xxxxxxxxxxxx> (Ralph Castain's message of "Mon, 30 Apr 2012 13:53:03 -0600")
- Organization: One Piece
- References: <912123A6-4633-4462-AD88-1400FDF93895@xxxxxxxxxxxx>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
- User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/23.4 (x86_64-pc-linux-gnu)
OoO En ce dÃbut de soirÃe du lundi 30 avril 2012, vers 21:53, Ralph
Castain <rhc@xxxxxxxxxxxx> disaitÂ:
> I'm working with priorities in events using libevent 2.0.13. Since I'm
> not using the most current release, I thought I'd ask about a behavior
> we are seeing that might be a potential bug.
> I have attached a simple reproducer of the problem. In short, suppose
> I have setup 8 priorities for my event base. I then execute an event
> at priority 4. In that callback, I setup and activate two new events -
> first one at priority 4, and then another at priority 0. We then cycle
> back through the event loop.
> Given the prioritized event base, I would expect the event at priority
> 0 to be called back first. However, this isn't what happens. Instead,
> the first event to be defined (in this case, the one at priority 4) is
> called back first.
> Is this the expected behavior? Can someone point me to the error in
> this reproducer that might be causing the problem?
I'd say it is the expected behaviour. Once you exit your callback,
libevent will look for the next event in the current priority queue and
it is the one you have just activated, so it calls its callback without
checking for other proprities.
Latest libevent 2.1.x alpha introduced the following function that may
suit your need:
http://www.wangafu.net/~nickm/libevent-2.1/doxygen/html/event_8h.html#a4ce79ea64f2fb7074487672801a1ad20
If you call `event_config_set_max_dispatch_interval()` with the third
parameter set to 1, you will get the expected behaviour.
--
Vincent Bernat â http://vincent.bernat.im
# Okay, what on Earth is this one supposed to be used for?
2.4.0 linux/drivers/char/cp437.uni
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.