gtpc2m0z | C/C++ Language Support User's Guide |
This function requests exclusive control over a resource. For example, to update a storage area such as a global record that is shared across processors in a multiprocessing environment, obtaining a pointer to the global and requesting corhc against it forces serialization on the global record during update.
Format
#include <tpfapi.h> void corhc(void *resource);
Normal Return
Void. Control is not returned to the issuing ECB until exclusive control over the resource is obtained.
Error Return
Not applicable.
Programming Considerations
When finished with the resource, the ECB must call coruc to free the resource. The pointer value (not the referenced value) passed to coruc must be the same as the pointer value passed to corhc. The pointer value is not required to reference a storage location.
Examples
The following example obtains a hold on global record _q05met based on the address of the record.
#include <tpfapi.h> #include <tpfglbl.h> #include <c$globz.h> struct msgexp *q05met;
·
·
·
q05met = *(struct msgexp **) glob(_q05met); corhc(q05met);
The following example obtains a lock on the resource name ABCD.
#include <tpfapi.h> #define RESOURCE_KEY ((void *) 0xC1C2C3C4)
·
·
·
corhc(RESOURCE_KEY);
Related Information