Tag_lock – Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 254

Advertising
background image

API Library of Routines

Appendix B

TAG_LOCK

B-123

This function locks the requested TAG memory area.

C Syntax

#include <copro.h>

unsigned TAG_LOCK (tag,timeout)

unsigned tag;
or
char *tag;
unsigned timeout;

Parameters

tag

Use to access the TAG table. This can be either the symbolic TAG or
the handle returned from a TAG_LINK or TAG_DEFINE call.

timeout

Timeout value in seconds, from 0 to 16,383. A value of CC_FOREVER
(defined in COPRO.H) will wait until the TAG has been locked.

Returns

Value

Symbolic Name

Meaning

0

CC_SUCCESS

Operation successful

120

CC_E_BADID

TAG define ID out of range

160

CC_E_INV_TO

Invalid timeout value

171

CC_E_TIME_LOCKED

Did not complete in time, TAG locked

176

CC_E_NOTAG

TAG not found

Description

Use the TAG_LOCK function to protect against concurrent access to the
tagged data when accessing the TAG without using TAG_READ or
TAG_WRITE.

Important: After access to the TAG is completed, you must call
TAG_UNLOCK to unlock the TAG; otherwise, the system may hang.

A status of CC_SUCCESS indicates that the calling procedure has locked
the TAG.

TAG_LOCK

Advertising