CEEOPML

C library interface: pthread_mutex_lock()

CEEOPML acquires (locks) the mutex referred to by mutex. If the mutex is already locked by another thread, the calling thread blocks until the mutex becomes available. This function returns with the mutex in the locked state with the calling thread as its owner.

Syntax

void CEEOPML (mutex, [fc])
CEE_MUTEX   *mutex;
FEED_BACK   *fc;
CEEOPML
Call this CWI interface as follows:
L     R15,CEECAALEOV-CEECAA(,R12)     CAA address is in R12
L     R15,0288(,R15)
BALR  R14,R15
mutex (input)
The mutex to be locked.
fc (output/optional)
The feedback code returned by the service. It indicates the degree of success in locking the mutex.

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

Condition  
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.
CEE5I6 Severity 3
Msg_No 5702
Message The current thread already owns the pthread_mutex_t object specified by mutex.
CEE5IO Severity 4
Msg_No 5720
Message Mutex specified by mutex was not locked because thread was forced to terminate.
CEE5IS Severity 0
Msg_No 5724
Message Not enough resource (other than memory).
CEE5K4 Severity 3
Msg_No 5764
Message The mutex specified by mutex 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.
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'.
CEE5L4 Severity 3
Msg_No 5796
Message The callable service, BPX1SMC, failed during shared lock processing. The system return code was return_code. The reason code was return_code X'00'.
Usage Notes:
  1. An attempt by the current owner of a mutex to relock the mutex is allowed if the CEEOPXS service was used to give the mutex the attribute RECURSIVE before the mutex was initialized with the CEEOPMI service. Otherwise, the mutex has (by default) the attribute NONRECURSIVE, and any request to relock it fails.
  2. A recursive mutex must be unlocked as many times as it has been locked and relocked to relinquish ownership.
  3. Only the owning thread (the thread which acquired a mutex) can unlock it.