From 118fd3e2e3a90679ef6ead9bfefab052bf4420e8 Mon Sep 17 00:00:00 2001 From: Vanilla Hsu Date: Thu, 12 Feb 2015 09:57:34 +0800 Subject: [PATCH] add '-DMDB_DSYNC=O_SYNC' on dragonflybsd. --- cursor.go | 1 + env.go | 1 + txn.go | 17 +++++++++-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cursor.go b/cursor.go index 75e0d14..b3718bb 100644 --- a/cursor.go +++ b/cursor.go @@ -5,6 +5,7 @@ package mdb #cgo freebsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo openbsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo netbsd CFLAGS: -DMDB_DSYNC=O_SYNC +#cgo dragonfly CFLAGS: -DMDB_DSYNC=O_SYNC #include #include #include "lmdb.h" diff --git a/env.go b/env.go index 08b4d0a..753ef98 100644 --- a/env.go +++ b/env.go @@ -5,6 +5,7 @@ package mdb #cgo freebsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo openbsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo netbsd CFLAGS: -DMDB_DSYNC=O_SYNC +#cgo dragonfly CFLAGS: -DMDB_DSYNC=O_SYNC #include #include #include "lmdb.h" diff --git a/txn.go b/txn.go index f08b894..40b0a03 100644 --- a/txn.go +++ b/txn.go @@ -5,6 +5,7 @@ package mdb #cgo freebsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo openbsd CFLAGS: -DMDB_DSYNC=O_SYNC #cgo netbsd CFLAGS: -DMDB_DSYNC=O_SYNC +#cgo dragonfly CFLAGS: -DMDB_DSYNC=O_SYNC #include #include #include "lmdb.h" @@ -66,20 +67,20 @@ func (env *Env) BeginTxn(parent *Txn, flags uint) (*Txn, error) { func (txn *Txn) Commit() error { ret := C.mdb_txn_commit(txn._txn) runtime.UnlockOSThread() - // The transaction handle is freed if there was no error - if ret == C.MDB_SUCCESS { - txn._txn = nil - } + // The transaction handle is freed if there was no error + if ret == C.MDB_SUCCESS { + txn._txn = nil + } return errno(ret) } func (txn *Txn) Abort() { if txn._txn == nil { - return - } - C.mdb_txn_abort(txn._txn) + return + } + C.mdb_txn_abort(txn._txn) runtime.UnlockOSThread() - // The transaction handle is always freed. + // The transaction handle is always freed. txn._txn = nil }