EPICS Base
7.0.6.1
|
For the impatient, the skeleton of a test:
Several helper functions are provided to interact with a running database.
Correct argument types must be used with var-arg functions.
When Put and Get aren't sufficient, testMonitor may help to setup and monitor for changes.
Helpers to synchronize with some database worker threads
This utility mutex is intended to be used to avoid races in situations where some other synchronization primitive is being destroyed (epicsEvent, epicsMutex, ...) and use of epicsThreadMustJoin() is impractical.
For example. The following has a subtle race where the event may be destroyed (free()'d) before the call to epicsEventMustSignal() has returned. On some targets this leads to a use after free() error.
When possible, the best way to avoid this race would be to join the worker before destroying the event.
Another way to avoid this race is to use a global mutex to ensure that epicsEventMustSignal() has returned before destroying the event. testGlobalLock() and testGlobalUnlock() provide access to such a mutex.
This must be a global mutex to avoid simply shifting the race from the event to a locally allocated mutex.