Patch: General locking (was Possible deadlock and solution)
Matthias Andree
matthias.andree at gmx.de
Wed Oct 2 10:57:13 CEST 2002
On Tue, 01 Oct 2002, David Relson wrote:
> >You'd usually clean up in the reverse order of allocation, last
> >allocated, first freed. It's also simpler code-wise ;-)
>
> Counting down to zero has a nice simplicity as well. Of course, if
> counting down is so superior, then the locking should also be done via
> count down <My turn to duck and run ...>
So do it :-)
> (On a side note, have you ever worked with a machine architecture in which
> the index registers are _subtracted_ from the array address? It makes for
> interesting assembly language coding.)
6502 and m68k don't do this. However, I found raw assembly too
cumbersome, so I went for the globally-optimizing macro assembler: C.
;-)
> >singly-linked lists stink <ducks & runs for cover>
>
> Sometimes that's all that's needed. For sure, they're easier to deal with
> than doubly-linked lists. For the case in hand, with a linked list, one
> knows that allocation is done when the end of the list is reached. No need
> to count !
Yes, that's fine, provided your rollback works (I often catch off-by-one
errors when using lists...). No big deal. If it saves setup cost (like
converting the list to an array), then go for linked lists.
In the duck & run section, we could go for C++ STL "vector"s to save
us the manual setup...
--
Matthias Andree
More information about the bogofilter-dev
mailing list