Skip to content
This repository was archived by the owner on Mar 4, 2018. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cursor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>
#include <stdio.h>
#include "lmdb.h"
Expand Down
1 change: 1 addition & 0 deletions env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>
#include <stdio.h>
#include "lmdb.h"
Expand Down
17 changes: 9 additions & 8 deletions txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>
#include <stdio.h>
#include "lmdb.h"
Expand Down Expand Up @@ -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
}

Expand Down