diff options
| author | Jordan Wiens <github@psifertex.com> | 2025-12-05 17:19:13 -0500 |
|---|---|---|
| committer | Jordan Wiens <github@psifertex.com> | 2025-12-05 17:19:18 -0500 |
| commit | f788c27bcb8851f594b63ccb2cca51887996f431 (patch) | |
| tree | 7384646e6a15a28f33e966d8c1170ab5b9516181 /python/mainthread.py | |
| parent | 3ce203911e47b3a4741753d989519439893dd94f (diff) | |
add examples for execute_ APIs
Diffstat (limited to 'python/mainthread.py')
| -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) |
