What is the best way to implement a unique incrementing value (for use as a key or value) with lmdb?

Is there a property if the transaction mechanism I could piggy-back off of to atomically generate my number?

Or should I block writers above mdb_cursor_put, do my lmdb transaction, and unblock?