AlreadyLocked returns true if safe mutex is already being held.
()
| 21 | |
| 22 | // AlreadyLocked returns true if safe mutex is already being held. |
| 23 | func (s *SafeMutex) AlreadyLocked() bool { |
| 24 | return atomic.LoadInt32(&s.writer) > 0 |
| 25 | } |
| 26 | |
| 27 | // Lock locks the safe mutex. |
| 28 | func (s *SafeMutex) Lock() { |