Attempt to acquire the lock; optionally specify the numRetries times to attempt again if this object is already locked. Return 0 on success, and a non‐zero value if the lock was not successfully acquired. The behavior is undefined unless 0 <= numRetries.