From f1d97429401367d0749e37f7f99cd163987e2a9c Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Thu, 30 Nov 2023 22:51:17 -0500 Subject: basic docs for some mainthread module APIs --- python/mainthread.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'python/mainthread.py') diff --git a/python/mainthread.py b/python/mainthread.py index 53b5c4ec..f7211ca6 100644 --- a/python/mainthread.py +++ b/python/mainthread.py @@ -25,6 +25,12 @@ from . import plugin def execute_on_main_thread(func): + """ + 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. + """ action = scriptingprovider._ThreadActionContext(func) obj = core.BNExecuteOnMainThread(0, action.callback) if obj: @@ -33,6 +39,12 @@ def execute_on_main_thread(func): def execute_on_main_thread_and_wait(func): + """ + The ``execute_on_main_thread`` function takes a single parameter which is a function that will be + 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. + """ action = scriptingprovider._ThreadActionContext(func) core.BNExecuteOnMainThreadAndWait(0, action.callback) @@ -53,10 +65,19 @@ def worker_interactive_enqueue(func, name=""): def get_worker_thread_count(): + """ + The ``get_worker_thread_count`` function returns the number of worker threads that are currently running. + By default, this is the number of cores on the system minus one, however this can be changed with + ``set_worker_thread_count``. + """ return core.BNGetWorkerThreadCount() def set_worker_thread_count(count): + """ + The ``set_worker_thread_count`` function sets the number of worker threads that are currently running. + By default, this is the number of cores on the system minus one. + """ core.BNSetWorkerThreadCount(count) -- cgit v1.3.1