This method tries to acquire the write lock (non-blocking). The method returns phRWLock_OWNED if the lock is still owned by another writer or any reader and phSUCCESS if it got the lock. It is sometimes the case where one wants to try to get a writer lock but waiting isn't needed. Execution can continue until the writer lock is available at a later point when writing to the protected area will take place.
- Returns:
- A value corresponding to the success of acquiring the write lock.
- Return values:
-
| phRWLock_OWNED | The lock is already owned by another thread and was not acquired for writing. |
| phRWLock_NOTLOCKED | The try on the lock failed for some other non-fatal reason than the lock being owned by another thread. |
| phSUCCESS | The reader-writer lock was successfully locked for writer mode. |
| phFAIL | The reader-writer lock acquisition failed for some fatal reason than the lock being owned by another thread. See phMutex::trylock() for some ideas that might cause this. |
Definition at line 1149 of file phRWLock.cpp. |