On Wed, 1 Aug 2018 08:57:39 -0400
Michel Machado <mic...@digirati.com.br> wrote:

> On 07/31/2018 09:40 PM, Wang, Yipeng1 wrote:
> > How about an API that is more universal? For example, an API such as 
> > "rte_iterate_conflict_entries".  After an insertion failure, this function 
> > will iterate all entries that may conflict with the newly inserted key and 
> > you could decide which entry to evict?  
> 
>     Fine. We'll rewrite the patch to do so.
> 
>     Thank you for the feedback.
> 
> [ ]'s
> Michel Machado

Often for time based cleanup it is better to have a second linked list that is 
ordered
by time value. Then the cleanup code can start at the oldest stop when it 
reaches
the last item that could expire.

That does mean having some form of lock and doing delete/insert on every usage.

i.e     
        spinlock(&timer_lock);
        TAILQ_REMOVE(&timer_list, entry, timer_list);
        entry->expiration = new time;
        TAILQ_INSERT_TAIL(&timer_list, entry, timer_list);
        spinunlock(&timer_unlock);

Reply via email to