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

Inoussa OUEDRAOGO inoussa12 at gmail.com
Fri Dec 19 16:48:22 CET 2008


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)
          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

  3 - Sergei Gorelkin : I would like to vote for removing avl_tree
dependency from the DOM altogether

I would like to bring back the discussion hoping that this time a
definitive solution will be adopted.

No matter what solution will be choosed, a thread-safe implementation
of AVL tree is a must, IMHO.

PS : the discussions are at

Best regards.

Inoussa O.

More information about the fpc-devel mailing list