diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/mainthread.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/mainthread.py b/python/mainthread.py index 96786342..298d9cf0 100644 --- a/python/mainthread.py +++ b/python/mainthread.py @@ -65,6 +65,12 @@ def execute_on_main_thread(func): on the main Binary Ninja thread. .. warning:: May be required for some GUI operations, but should be used sparingly as it can block the UI. + + :Example: + >>> # Execute a GUI operation on the main thread + >>> import binaryninjaui + >>> from binaryninja import execute_on_main_thread + >>> execute_on_main_thread(lambda: binaryninjaui.UIContext.activeContext().openFileContext(context)) """ action = scriptingprovider._ThreadActionContext(func) obj = core.BNExecuteOnMainThread(0, action.callback) @@ -79,6 +85,12 @@ def execute_on_main_thread_and_wait(func): executed on the main Binary Ninja thread and will block execution of further python until the function returns. .. warning:: May be required for some GUI operations, but should be used sparingly as it can block the UI. + + :Example: + >>> # Execute a GUI operation and wait for it to complete + >>> import binaryninjaui + >>> from binaryninja import execute_on_main_thread_and_wait + >>> execute_on_main_thread_and_wait(lambda: binaryninjaui.UIContext.activeContext().rebaseCurrentView(0x800000)) """ action = scriptingprovider._ThreadActionContext(func) core.BNExecuteOnMainThreadAndWait(0, action.callback) |
