Prevent crash if python code is executed in a rocksdb background thread
This commit is contained in:
parent
ecb6e26546
commit
0d20a2564a
1 changed files with 7 additions and 0 deletions
|
@ -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():
|
||||
|
|
Loading…
Reference in a new issue