diff options
author | IRIE Shinsuke <irieshinsuke@yahoo.co.jp> | 2013-12-17 11:44:56 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-12-17 11:44:56 +0400 |
commit | 5036ac6903da222c68aac76bee49006d7e6724c1 (patch) | |
tree | 5b5ea301318f47af1d049ee8347eb71407bb6226 /source/blender/python/BPY_extern.h | |
parent | f1a989f9c35d496842b2cfa44d90ee0019c06e22 (diff) |
Partial fix for T37604: Deadlock when stopping rendered viewport (Blender Internal)
- Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS macros cannot be used here, because the Py_BEGIN_ALLOW_THREADS causes a crash when quitting Blender.
- The low level function PyEval_ReleaseLock() is used assuming the Python library was built with multi-threads support.
Diffstat (limited to 'source/blender/python/BPY_extern.h')
-rw-r--r-- | source/blender/python/BPY_extern.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index acb1ab2bcd0..697fa915293 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -60,6 +60,19 @@ void BPY_python_start(int argc, const char **argv); void BPY_python_end(void); void BPY_python_reset(struct bContext *C); + +/* global interpreter lock */ + +typedef void *BPy_ThreadStatePtr; + +BPy_ThreadStatePtr BPY_thread_save(void); +void BPY_thread_restore(BPy_ThreadStatePtr tstate); + +/* our own wrappers to Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS */ +#define BPy_BEGIN_ALLOW_THREADS { BPy_ThreadStatePtr _bpy_saved_tstate = BPY_thread_save(); (void)0 +#define BPy_END_ALLOW_THREADS BPY_thread_restore(_bpy_saved_tstate); } (void)0 + + /* 2.5 UI Scripts */ int BPY_filepath_exec(struct bContext *C, const char *filepath, struct ReportList *reports); int BPY_text_exec(struct bContext *C, struct Text *text, struct ReportList *reports, const bool do_jump); |