Code review comment for ~epics-core/epics-base/+git/database:putf-pact

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

Added proposed fix for the second part of lp:1809570.

This adds dbCommonPvt::procThread to track the thread which is currently processing a record.
This is set, and cleared, by processTarget(). This is called during dbPutLink() for a DB_LINK.

procThread will either be NULL, or contain the epicsThreadId for the current thread. Any other value is a logic error (missing dbScanLock(), or maybe incorrect lockset calculation).

The logic in processTarget() checks both the source record and destination record. procThread for the source will be NULL when the first link in a record chain is handled. Subsequent links in a chain will find source procThread==self. For the target record, procThread will be NULL, unless a loop would be closed.

The possible states of PACT and procThread on entry to processTarget() are

!PACT && !procThread - Idle record
!PACT && procThread - Logic error?
PACT && !procThread - Waiting for driver/rset to complete
PACT & procThread - process() in progress on this thread.

« Back to merge proposal