Last active
December 16, 2015 22:39
-
-
Save bernerdschaefer/5508573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prints "Storage is closed; exiting" and then hangs | |
package main | |
import ( | |
"github.com/jmhodges/levigo" | |
"log" | |
) | |
func main() { | |
options := levigo.NewOptions() | |
storage, err := levigo.Open("/tmp/levigo-closing-test", options) | |
if err != nil { | |
log.Fatal(err) | |
} | |
defer storage.Close() | |
storage.Close() | |
log.Println("Storage is closed; exiting") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// prints "Storage is closed; getting value" and then hangs | |
package main | |
import ( | |
"github.com/jmhodges/levigo" | |
"log" | |
) | |
func main() { | |
options := levigo.NewOptions() | |
storage, err := levigo.Open("/tmp/levigo-closing-test", options) | |
if err != nil { | |
log.Fatal(err) | |
} | |
readOptions := levigo.NewReadOptions() | |
storage.Close() | |
log.Println("Storage is closed; getting value") | |
storage.Get(readOptions, []byte("key")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment