diff --git a/rocksdb/_rocksdb.pyx b/rocksdb/_rocksdb.pyx index 8b3e055..423f4ba 100644 --- a/rocksdb/_rocksdb.pyx +++ b/rocksdb/_rocksdb.pyx @@ -35,6 +35,13 @@ import errors cdef extern from "cpp/utils.hpp" namespace "py_rocks": cdef const Slice* vector_data(vector[Slice]&) +# Prepare python for threaded usage. +# Python callbacks (merge, comparator) +# could be executed in a rocksdb background thread (eg. compaction). +cdef extern from "Python.h": + void PyEval_InitThreads() +PyEval_InitThreads() + ## Here comes the stuff to wrap the status to exception cdef check_status(const Status& st): if st.ok():