On Wed, Jun 19, 2013 at 8:19 AM, liu lily <politoeso...@gmail.com> wrote:

>
>    I have some questions on libevent event priority
>
> 1 what is the priority number range?
>

That's a property of the event_base, and is configured by
event_base_priority_init() when you're constructing the event_base.


> 2 in the mannual, it says By default, libevent assigns the middle
> priority to all events unless their priority is explicitly set. so what
> is the exact default priority number?
>

It's the maximum priority value plus one, divided by 2.

> 3 when priority is higher, the number is smaller or larger?
>

Numerically lower priority values are more high-priority.


> 4 There are two functions which are related to event priority in libevent.
> event_priority_init() and event_priority_set, what are the differences
> between them?
>

event_base_priority_init() sets up priorities in an event_base.
 event_priority_set() changes the priority of an event.
 event_priority_init() is deprecated.


> 5 what are return values for event_priority_set(struct event *ev, int
> pri)? I notice an article says something like: when an event is ready, it
> can't be set and calling of this function returns -1. I really don't
> understand what does this mean? can anyone explain a bit? thanks!
>

I don't know what article you're talking about. Try looking at the
reference manual at http://www.wangafu.net/~nickm/libevent-book/ and at the
documentation in the header files.

Reply via email to