summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2023-11-30 22:51:17 -0500
committerJordan Wiens <jordan@psifertex.com>2023-11-30 22:51:17 -0500
commitf1d97429401367d0749e37f7f99cd163987e2a9c (patch)
treeb50caceec1841c51ee3b2b7b87c795482078fe6b /python
parentd40ab66a50fa8f33451458be15582c7a8d93fd5f (diff)
basic docs for some mainthread module APIs
Diffstat (limited to 'python')
-rw-r--r--python/mainthread.py21
1 files changed, 21 insertions, 0 deletions
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)