tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: in which we present an ugly hack to make sys/queue.h CIRCLEQ work



>This functionally works, but the TAILQ data structure is not the same as
>the CIRCLEQ data structure (i.e. no ABI compatibility, if that matters;
>I'm not quite sure why it does) and unnecessarily penalizes applications
>which need to traverse the list in the tail->head direction.

I know the data structures aren't the same, but if you're using the macros
you don't ever notice this.    As for the penalty ... you're talking
about:

#define CIRCLEQ_PREV(elm,field) ((elm)->field.cqe_prev)

versus

#define TAILQ_PREV(elm, headname, field)                                \
        (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))

One extra pointer dereference is what we're talking about; I have to
believe that for 99% of applications it wouldn't matter.

Also, I see that CIRCLEQ has more complicated logic if you want to
insert elements at the end of it.  So obviously there are tradeoffs (but
again, I don't really think it matters to nearly everybody).

--Ken

--Ken


Home | Main Index | Thread Index | Old Index