LockWrite takes an anonymous function and runs it while using a write lock. This ensures that the lock is automatically released once the function finishes.
(f func())
| 126 | // LockWrite takes an anonymous function and runs it while using a write lock. This ensures that the lock is |
| 127 | // automatically released once the function finishes. |
| 128 | func LockWrite(f func()) { |
| 129 | globalLock.Lock() |
| 130 | defer globalLock.Unlock() |
| 131 | f() |
| 132 | } |
| 133 | |
| 134 | // dbInit handle the global database initialization. Panics if an error occurs, since it points to something going |
| 135 | // terribly wrong. |