HasLock checks current process owns lock or not
(path string)
| 114 | |
| 115 | //HasLock checks current process owns lock or not |
| 116 | func (s *Sync) HasLock(path string) bool { |
| 117 | value, ok := s.locks.Get(path) |
| 118 | if !ok { |
| 119 | return false |
| 120 | } |
| 121 | isLocked, _ := value.(bool) |
| 122 | return isLocked |
| 123 | } |
| 124 | |
| 125 | // Lock locks resources on sync |
| 126 | // This call blocks until you can get lock |