glob_sync: Synchronize z/TPF global field or record

This function synchronizes the field or record across processors in a loosely coupled complex and then unlocks the field or record. The glob_lock function must have previously been called. This function is valid only for synchronizable z/TPF global fields and records.

Last updated

Changed for PUT00.

Format

maketpf_env += system                              
#include <tpf/tpfglbl.h>                           
#include <tpf/c_globz.h>                           
void glob_sync(unsigned int tagname);
tagname
This argument, which is defined in header file c_globz.h, uniquely identifies the z/TPF global field or record to be synchronized.

Normal return

Void.

Error return

Not applicable.

Programming considerations

  • The argument coded as tagname must be defined in header file c_globz.h. Results will be unpredictable if this restriction is not heeded.
  • When completed successfully, storage protection is set to that of working storage.
  • Programs using this function should not have any pending I/O operations outstanding because this function may perform the equivalent of a waitc function.
  • This function performs the equivalent of a SYNCC SYNC assembler macro.
  • Use this function only with z/TPF format-1 globals. To synchronize z/TPF format-2 globals, use the tpf_glWrite and tpf_glClose functions.

Examples

The following example locks, updates and synchronizes a global field.
#include <tpf/tpfglbl.h>
#include <tpf/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;
    msgrptr->mysdata = newdata;
	 glob_sync(_mysglob);
}

Related information

See z/TPF C functions overview for more information about z/TPF C/C++ language support.