CEEOPWT

C library interface: pthread_rwlock_trywrlock()

CEEOPWT conditionally acquires (locks) the read-write lock for write referred to by rwlock. Conditionally means the call always returns immediately, whether or not the lock is acquired. If the read-write lock is already locked, the read-write lock is not acquired. When successful, this function returns with the read-write lock in the locked state with the calling thread as its owner.
Note: Only the owning thread (the thread that acquired a read-write lock) can unlock it.

Syntax

void CEEOPWT (rwlock, [fc])
CEE_RWLOCK   *rwlock;
FEED_BACK    *fc;
CEEOPWT
Call this CWI interface as follows:
L     R15,CEECAALEOV-CEECAA(,R12)     CAA address is in R12
L     R15,512(,R15)
BALR  R14,R15
rwlock (input)
The read-write lock to be locked for write conditionally.
fc (output/optional)
The feedback code returned by the service. It indicates the degree of success in locking the read-write lock for write conditionally.

The following message identifiers and associated severities can be returned by the service in the feedback code fc.

Condition Description category Description value
CEE000 Severity 0
Msg_No 0000
Message The service completed successfully.
CEE4S9 Severity 3
Msg_No 5001
Message The service is unavailable unless POSIX(ON) runtime option specified and z/OS UNIX System Services are started.
CEE5K4 Severity 3
Msg_No 5764
Message The read-write lock specified by the rwlock was not initialized.
CEE5K6 Severity 3
Msg_No 5766
Message An addressing exception occurred referencing a lock object.
CEE5K7 Severity 4
Msg_No 5767
Message Address exception while referencing system storage allocated by lock object initialization.
CEE5KN Severity 4
Msg_No 5783
Message Read-write lock specified by rwlock was not locked because thread was forced to terminate.
CEE5KQ Severity 3
Msg_No 5786
Message The callable service BPX1SLK failed during shared lock processing. The system return code was return_code, the reason code was reason_code, X'00'.
CEE5KT Severity 1
Msg_No 5785
Message The read-write lock specified by rwlock was busy.
CEE5KU Severity 3
Msg_No 5790
Message Insufficient storage to lock the read-write lock object specified by rwlock.
CEE5KV Severity 4
Msg_No 5791
Message System read-write lock storage could not be freed.
Usage notes:
  1. The routine to be executed was previously established by the pthread_cleanup_push() (CEEOPCPO) function.
  2. It is assumed that routine is currently available and does not require an explicit LOAD performed.