Macrotask Synchronization: LOCK
‘critical section’: use lock variable as semaphore
additional calls outside the parallel region needed:
- call PLASGN(ilock) : assign a lock to variable ilock
- call PLFREE(ilock) : release the lock variable ilock
check lock status: IPLSTAT(ilock), IPLSTATL(ilock)
subroutine SUMUP( nstart, nend, sum, a )
sumlocal = sumlocal + a(I)