The ``execute_on_main_thread`` function takes a single parameter which is a function that will be executed 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.
(func)
| 60 | |
| 61 | |
| 62 | def execute_on_main_thread(func): |
| 63 | """ |
| 64 | The ``execute_on_main_thread`` function takes a single parameter which is a function that will be executed |
| 65 | on the main Binary Ninja thread. |
| 66 | |
| 67 | .. warning:: May be required for some GUI operations, but should be used sparingly as it can block the UI. |
| 68 | """ |
| 69 | action = scriptingprovider._ThreadActionContext(func) |
| 70 | obj = core.BNExecuteOnMainThread(0, action.callback) |
| 71 | if obj: |
| 72 | return plugin.MainThreadAction(obj) |
| 73 | return None |
| 74 | |
| 75 | |
| 76 | def execute_on_main_thread_and_wait(func): |
no test coverage detected