All EVM API functions are thread-safe. In few
cases where it is necessary to use internal static storage, the APIs
use locks to protect the storage from simultaneous access by separate
threads. Nevertheless, if you are using EVM API calls in a multithreaded
program, you must take certain precautions to avoid the following
synchronization errors:
If possible, restrict the use of any entity returned
by any API function to the thread in which it was established. Table 3-1 lists the entities that must
be thread-safe.
Table 3-1 Entities to be Thread Safe
| Entity | Type | Returned by |
|---|
| Connection
context | EvmConnection_t | EvmConnCreate() |
| Event | EvmEvent_t | | EvmEventCreate() | | EvmEventCreateVa() | | EvmEventRead() | | EvmEventDup() |
|
| Data
item | EvmItemValue_t | EvmItemGet() |
| Data
item list | EvmItemList_t | EvmItemListGet() |
| Variable | EvmVarValue_t | EvmVarGet() |
| Variable
list | EvmVarList_t | EvmVarListGet() |
| Event
filter | EvmFilter_t | EvmFilterCreate() |
| Connection
fd | EvmFd_t | EvmConnFdGet() |
If it is necessary to refer to these entities in more
than one thread, you must protect them against simultaneous access,
or perform updates by using locks.
If you do not follow these rules, random errors
can occur.