IoMgrLockEnter
(FUN)
FUNCTION IoMgrLockEnter : RTS_IEC_RESULT
This function acquires the mutual-exclusion locks for the given operations
for critical sections inside the I/O driver’s implementation of IoDrvReadInputs(), IoDrvWriteOutputs(), and IoDrvStartBusCycle().
The locks can be released with the function IoMgrLockLeave()
.
While a lock is held, any other thread is blocked from acquiring the lock and waits until the lock is released.
IMPLEMENTATION NOTE: The behavior of the dwLockScope
parameter can’t be implemented on all platforms.
Platforms without synchronization functionality may not be able to implement this behavior.
IoMgrEmbedded of the CODESYSControlEmbedded runtime system for example can only disable and enable all interrupts.
- InOut:
Scope
Name
Type
Comment
Return
IoMgrLockEnter
RTS_IEC_RESULT
- error code
ERR_OK: Locks were successfully acquired.
ERR_PARAMETER: The
pbyIoDrv
parameter isNULL
(only implementations that use this parameter), or thedwLockScope
parameter has none of the GVL LockScopes set (only implementations that use this parameter).ERR_FAILED: No driver entry for pbyIoDrv found in device pool.
Input
hIoDrv
RTS_IEC_HANDLE
Handle to the driver instance which is returned by the function IoMgrRegisterInstance2().
dwLockScope
DWORD
The operations for which to acquire locks. See GVL LockScopes for detailed information.