TestStand 2019 Help
»View Product Info
You can modify and access the structure, values, and other settings of TestStand variables concurrently from multiple threads without causing crashes, various errors, or data inconsistencies. Use the PropertyObject.GetSubProperties and PropertyObject.GetPropertyObjectElements methods to obtain references to all subproperties or elements of a property in one atomic call to avoid issues with invalid indexes that result when another thread removes or inserts properties or elements while a different thread iterates through the subproperties or elements. Use synchronization primitives, such as locks or semaphores, if you need to maintain atomicity or control editing and data access across multiple edits or PropertyObject API calls.
Actions That Are Thread-Safe in TestStand
The following actions are thread-safe in TestStand:
- Using the PropertyObject API or TestStand expressions to access or modify variables from one thread while modifying the structure of such variables in another thread. You can access or modify the parent, the name, and other items that are accessible through the PropertyObject API.
- Serializing variables by using the Engine.SerializeObjects method with the SerializationOption_UseBinary or SerializationOption_UseXml options or by saving a PropertyObjectFile in the XML or Binary format while modifying the structure of such variables in another thread. TestStand maintains the serialized data in a consistent state. However, the timing of the serialization code in regard to the concurrent modifications determines what TestStand actually serializes.
Actions That Are Not Thread-Safe in TestStand
The following actions are not thread-safe in TestStand:
- Modifying a type definition in one thread while other threads access the same type definition or its instances.
- Serializing variables using an INI-based format while modifying the structure of such variables in another thread.
- Accessing API properties and methods of a SequenceContext object from a thread other than the thread the object belongs to while the thread the SequenceContext object belongs to runs the TestStand sequence to which the SequenceContext object applies.
- Modifying the structure of built-in properties for steps, sequences, and SequenceContext objects while another thread accesses those objects.