[fpc-devel] TAVLTree(avl_tree.pp) and "XML DOM" (dom.pp) thread safety issues

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Dec 19 17:05:46 CET 2008


On Fri, 19 Dec 2008 16:48:22 +0100
"Inoussa OUEDRAOGO" <inoussa12 at gmail.com> wrote:

> Hi,
> 
> A discussion started a month or two ago about the thread safety issue
> concerning XML DOM, issue due to avl_tree.pp implementation.
> 
> There were 3 propositions :
> 
>   1 - Inoussa OUEDRAOGO :
>         Another proposition is to introduce a base avl class say
> TBaseAVLTree that defines two abstract virtual methods "NewNode()"
> and "FreeNode()" and then define :
>          - TAVLTree : that _do not_ use a node mem manager, then
> thread safe.
>          - TAVLManagedTree that uses a node mem manager provided in
> the constructor.
>            The developer using this one is _aware_ of the thread
> safety issue and can
>            then provide a thread safe node mem manager for an
> instance exposed to more than one thread while using the default not
> thread safe node mem manager for a thread local instance
> 
>   2 - Marc Weustink :
>           I'm pro having a manged and an unmanaged avltree. One (big)
> disadvantage
>           of the current implementation (with a shared node manager
> for all trees)
>           is that you cannot add custom derived treenodes since they
> will be released in the pool too.
>       Mattias Gärtner :
>           I think too, that we need a fast, lightweight tree and a
> slower, but customizable tree. Something like TFPList and TList. One
> without virtual
>           methods and one with virtual methods and definable node
> class
>[...]
> No matter what solution will be choosed, a thread-safe implementation
> of AVL tree is a must, IMHO.

Yes.
1+2 sounds compatible.

Will you provide a patch?

Mattias



More information about the fpc-devel mailing list