szferi/gomdb — pull request #31 by bmatsuo (2014-08-13 07:44:22+00:00)
Title: fix thread locking for nested transaction

Nested transaction need to know that they are nested so they don't call `runtime.UnlockOSThread` while their parent is pending.

There's a pretty big warning about thread safety on the godoc for BeginTxn. Maybe at some point the "BUG:" part is removed and this is just a feature of the Txn type. IDK. For now I think it should be considered a bug.

Note: I made the Cursor type aware that it was created from a nested transaction so that its Txn method can work properly (the transaction will not unlock the goroutine on Commit/Abort).