Parallel Programming Guide for HP-UX Systems

Parallel synchronization
Synchronization tools
Chapter 8 139
where (in Fortran)
gate
and
barrier
are gate or barrier variables previously declared in
the gate and barrier allocation functions.
where (in C/C++)
gate_p
and barrier_p are pointers of the indicated type.
NOTE Always free gates and barriers after using them.
Locking functions
The locking functions acquire a gate for exclusive access. If the gate
cannot be immediately acquired, the calling thread waits for it. The
conditional locking functions, which are prefixed with COND_ or cond_,
acquire a gate only if a wait is not required. If the gate is acquired, the
functions return 0; if not, they return -1.
The forms of these locking functions are shown in Table 8-4.
C/C++ int free_gate(gate_t *gate_p);
int free_barrier(barrier_t *barrier_p);
Table 8-3 Forms of deallocation functions (Continued)
Language Form
Table 8-4 Forms of locking functions
Language Form
Fortran INTEGER FUNCTION LOCK_GATE(gate)
INTEGER FUNCTION COND_LOCK_GATE(gate)
C/C++ int lock_gate(gate_t *gate_p);
int cond_lock_gate(gate_t *gate_p);