Close releases all database resources. It will block waiting for any open transactions to finish before closing the database and returning.
()
| 692 | // It will block waiting for any open transactions to finish |
| 693 | // before closing the database and returning. |
| 694 | func (db *DB) Close() error { |
| 695 | db.rwlock.Lock() |
| 696 | defer db.rwlock.Unlock() |
| 697 | |
| 698 | db.metalock.Lock() |
| 699 | defer db.metalock.Unlock() |
| 700 | |
| 701 | db.mmaplock.Lock() |
| 702 | defer db.mmaplock.Unlock() |
| 703 | |
| 704 | return db.close() |
| 705 | } |
| 706 | |
| 707 | func (db *DB) close() error { |
| 708 | if !db.opened { |