Skip to Content

Support for global data structures (variables, dictionaries, and vectors) was added in ESP 5.1 SP01.  This allows for safe read and write access to global elements.  Unfortunately I just found out that the documentation did not get updated to reflect this.  We will get the doc corrected.  But in the mean-time I wanted to make you aware of this powerful feature.

See the ESP Programmers Guide documentation on use of the DECLARE statement for how to declare a global data structure.

The key point is that global dictionaries (and variables and vectors) are now thread safe (as long as you are using SP01 or later).

But do note some important precautions before you jump in and start using these:

While dictionaries and vectors can be defined globally, care should be taken when using global structures. First, as ESP is multi-threaded, bear in mind when accessing a structure that can be modified from multiple threads that the state of the structure when you are accessing it may not actually be what you assume it to be – consider your design carefully. You should also consider the impact on performance, particularly anywhere that you iterate over a data structure – especially a large one. Any CCL query or flex operator that iterates over a data structure will lock the structure while it iterates over it – blocking any other thread. Thus performance will degrade significantly with the number of concurrent queries iterating over the global structure.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Tom Kim

    what is the reason that a query or queries place lock(s) on the data structure? I can understand why a write would place a lock. Suppose I have a global structure that only loaded at startup and thereafter read-only access. a lock on queries/iterations would impose performance penalties.

    (0) 

Leave a Reply