From: Gregory P. Smith Date: Thu, 28 Aug 2003 21:50:30 +0000 (+0000) Subject: Support DBEnv.set_shm_key() to allow multi-threaded multi-process X-Git-Tag: v2.4a1~1698 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6676f6edc11bd3e3e1559a76aab22c6af6faf14e;p=python Support DBEnv.set_shm_key() to allow multi-threaded multi-process database environments to use shared memory on systems supporting it. --- diff --git a/Lib/bsddb/dbobj.py b/Lib/bsddb/dbobj.py index d23f533f34..abda657ba6 100644 --- a/Lib/bsddb/dbobj.py +++ b/Lib/bsddb/dbobj.py @@ -39,6 +39,8 @@ class DBEnv: return apply(self._cobj.open, args, kwargs) def remove(self, *args, **kwargs): return apply(self._cobj.remove, args, kwargs) + def set_shm_key(self, *args, **kwargs): + return apply(self._cobj.set_shm_key, args, kwargs) def set_cachesize(self, *args, **kwargs): return apply(self._cobj.set_cachesize, args, kwargs) def set_data_dir(self, *args, **kwargs): diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 990c89f215..dcbcdb37ce 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -3276,6 +3276,21 @@ DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) } #endif /* DBVER >= 40 */ +static PyObject* +DBEnv_set_shm_key(DBEnvObject* self, PyObject* args) +{ + int err; + long shm_key = 0; + + if (!PyArg_ParseTuple(args, "l:set_shm_key", &shm_key)) + return NULL; + CHECK_ENV_NOT_CLOSED(self); + + err = self->db_env->set_shm_key(self->db_env, shm_key); + RETURN_IF_ERR(); + RETURN_NONE(); +} + static PyObject* DBEnv_set_cachesize(DBEnvObject* self, PyObject* args) { @@ -4076,6 +4091,7 @@ static PyMethodDef DBEnv_methods[] = { #if (DBVER >= 40) {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, #endif + {"set_shm_key", (PyCFunction)DBEnv_set_shm_key, METH_VARARGS}, {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, #if (DBVER >= 32)