Liquid XML Data Binder (C++, Java, VB6) / Using the Code / Things to be aware of when developing Multithreaded Applications
In This Topic
    Things to be aware of when developing Multithreaded Applications
    In This Topic


    The generated Libraries are thread safe with a small caveat.
    By thread safe we mean that 2 instances of the same object can be used in different threads safely. If you want to share the same object from 2 different threads, then you must control the synchronization yourself.


    The settings that effect serialization (both to and from XML) are held in a class called SerialzationContext. Each of the toXmlXXXX & fromXmlXXXX methods accept an instance of the XmlSerialzationContext object. For convenience there are a number of simple over loads (of the toXmlXXXX and fromXmlXXX methods) that make use of a globally defined instance of a XmlSerialzationContext object.

    This globally defined instance may be a problem if you are running in a multithreaded environment. Typically the object is setup at the start of the app and never changed. The object is thread safe for reading, but not writing. So if you are planning to change this object during the lifetime of the app, then it is recommended that you create an instance for each thread and use this instance explicitly when calling toXml and fromXml methods.

    Note : This global instance was created to make things simple for the majority of people (who never concern themselves with the complexities of threading).


    Description Value
    Article Created 6/2/2006
    Versions Liquid XML 2005 (4.1.0) and greater
    Also See SerializationContext C++ C#, Java Visual Basic 6
      ToXml C++ C# Java  
      ToXmlFile C++ C# Java  
      ToXmlStream C++ C# Java  
      FromXml C++ C# Java  
      FromXmlFile C++ C# Java  
      FromXmlStream C++ C# Java  
      FromXmlElement C++ C# Java