gtpc2m45 | C/C++ Language Support User's Guide |
This function reserves exclusive write access to the specified TPF global field or record and forces refreshing of the core copy from the most current file copy. You should ensure that a lock is held for the shortest possible time because severe system degradation may result from other ECBs waiting for locks. This function is valid only for synchronizable TPF global fields and records.
Format
#include <tpfglbl.h> #include <c$globz.h> void *glob_lock(unsigned int tagname);
Normal Return
This function returns a pointer to the specified TPF global field or record's directory entry (for example, a pointer to the field or record's address).
Error Return
Not applicable.
Programming Considerations
Examples
The following example locks and updates a synchronizable global field.
#include <tpfglbl.h> #include <c$globz.h>
·
·
·
{ /******************************************************************/ /* Increment data element mysdata in synchronizable global record */ /* _mysglob. */ /******************************************************************/ struct mysglbrec **msgrptrptr = glob_lock(_mysglob); struct mysglbrec *msgrptr = *msgrptrptr; long newdata = msgrptr->mysdata + 1; glob_update(_mysglob, &msgrptr->mysdata, &newdata, sizeof msgrptr->mysdata); }
Related Information