Cleanup thread-safe work, bump version.

FossilOrigin-Name: 2d0770a550c41261b3bc7e54aaeb02809ca991e92f25c71f5864cda9d873fc27
This commit is contained in:
Mahlon E. Smith 2025-05-01 00:54:21 +00:00
parent 48e2184570
commit 3ddd85b591
4 changed files with 14 additions and 12 deletions

View file

@ -1,5 +1,13 @@
# Release History for MDBX
---
## v0.4.0 [2025-04-30] Mahlon E. Smith <mahlon@martini.nu>
Enhancements:
- Opening a long running transaction is now thread safe.
---
## v0.3.8 [2025-02-20] Mahlon E. Smith <mahlon@martini.nu>

View file

@ -465,27 +465,21 @@ rmdbx_in_transaction_p( VALUE self )
}
/* Inline struct for transaction arguments, passed as a void pointer. */
struct txn_open_args_s {
rmdbx_db_t *db;
int rwflag;
};
/* Opens a transaction outside of th GVL. */
/* Opens a transaction outside of the GVL. */
void *
rmdbx_open_txn_without_gvl( void *ptr )
{
// struct query_call *qcall = (struct query_call *)ptr;
struct txn_open_args_s *txn_open_args = (struct txn_open_args_s *)ptr;
rmdbx_db_t *db = txn_open_args->db;
int rc = mdbx_txn_begin(
db->env,
NULL,
txn_open_args->rwflag,
&db->txn
);
int rc = mdbx_txn_begin( db->env, NULL, txn_open_args->rwflag, &db->txn );
return (void *)rc;
}
@ -508,7 +502,7 @@ rmdbx_open_txn( rmdbx_db_t *db, int rwflag )
void *result_ptr = rb_thread_call_without_gvl(
rmdbx_open_txn_without_gvl, (void *)&txn_open_args,
NULL, NULL
RUBY_UBF_IO, NULL
);
int rc = (int)result_ptr;

View file

@ -1,9 +1,9 @@
#include <ruby.h>
#include <ruby/thread.h>
#include "extconf.h"
#include "mdbx.h"
#include "ruby/thread.h"
#ifndef RBMDBX_EXT
#define RBMDBX_EXT

View file

@ -13,7 +13,7 @@ module MDBX
extend Loggability
# The version of this gem.
VERSION = '0.3.8'
VERSION = '0.4.0'
log_as :mdbx