diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2003-03-27 17:23:29 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2003-03-27 17:23:29 (GMT) |
commit | fe11d3e0d4385400999c89e22ea7bc3542564f47 (patch) | |
tree | c3a1d3e5c118b6326da02c15fe81bb1914a3d40f /Modules/_bsddb.c | |
parent | 3ae0f7a7cf8c7555a654542811509d4c17b49497 (diff) | |
download | cpython-fe11d3e0d4385400999c89e22ea7bc3542564f47.zip cpython-fe11d3e0d4385400999c89e22ea7bc3542564f47.tar.gz cpython-fe11d3e0d4385400999c89e22ea7bc3542564f47.tar.bz2 |
Adds support for the DBEnv->set_timeout() method.
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 744d854..0df7fa2 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -3163,6 +3163,29 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs) } #endif /* DBVER >= 41 */ +#if (DBVER >= 40) +static PyObject* +DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) +{ + int err; + u_int32_t flags=0; + u_int32_t timeout = 0; + char* kwnames[] = { "timeout", "flags", NULL }; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames, + &timeout, &flags)) { + return NULL; + } + + MYDB_BEGIN_ALLOW_THREADS; + err = self->db_env->set_timeout(self->db_env, (db_timeout_t)timeout, flags); + MYDB_END_ALLOW_THREADS; + + RETURN_IF_ERR(); + RETURN_NONE(); +} +#endif /* DBVER >= 40 */ + static PyObject* DBEnv_set_cachesize(DBEnvObject* self, PyObject* args) { @@ -3956,6 +3979,9 @@ static PyMethodDef DBEnv_methods[] = { {"dbrename", (PyCFunction)DBEnv_dbrename, METH_VARARGS|METH_KEYWORDS}, {"set_encrypt", (PyCFunction)DBEnv_set_encrypt, METH_VARARGS|METH_KEYWORDS}, #endif +#if (DBVER >= 40) + {"set_timeout", (PyCFunction)DBEnv_set_timeout, METH_VARARGS|METH_KEYWORDS}, +#endif {"set_cachesize", (PyCFunction)DBEnv_set_cachesize, METH_VARARGS}, {"set_data_dir", (PyCFunction)DBEnv_set_data_dir, METH_VARARGS}, #if (DBVER >= 32) |