@@ -12,8 +12,13 @@ type TryLocker interface {
1212 // TryLock acquires the write lock without blocking.
1313 // On success, returns true. On failure or context cancellation,
1414 // returns false.
15+ // A nil Context means try and return at once.
1516 TryLock (context.Context ) bool
1617
18+ // TryLockTimeout acquires the write lock without blocking.
19+ // On success, returns true. On failure or timeout, returns false.
20+ // A negative timeout means no timeout.
21+ // A zero timeout means try and return at once.
1722 TryLockTimeout (time.Duration ) bool
1823
1924 // Lock locks for writing.
@@ -26,8 +31,13 @@ type TryLocker interface {
2631
2732 // RTryLock acquires the read lock without blocking.
2833 // On success, returns true. On failure or timeout, returns false.
34+ // A nil Context means try and return at once.
2935 RTryLock (context.Context ) bool
3036
37+ // RTryLockTimeout acquires the read lock without blocking.
38+ // On success, returns true. On failure or timeout, returns false.
39+ // A negative timeout means no timeout.
40+ // A zero timeout means try and return at once.
3141 RTryLockTimeout (time.Duration ) bool
3242
3343 // RLock locks for reading.
0 commit comments