Vector35 / Vector35/binaryninja-api
Clarifications on Multi-Threading and BackgroundTask on native plugin APIs
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.3k
- Forks
- 298
- Avg merge
- 5d 5h
- Merged PRs (30d)
- 19
Description
Is this a general concept that needs to be documented or a specific API?
Multi-Threading in the C++ API. How can we achieve work in the background without locking the main thread (and thus the UI)? Mainly involving the usage of BackgroundTask, as I attempted to use the structure but have been met with nothing other than crashes (even despite using the function that appears to synchronize things when in parallel BinaryNinja::RunOnMainThreadAndWait and related functions, but still leading to a crash). This is particularly frustrating when developing plugins that take some time to do their work, i.e., signature matchers, RTTI scanners, and other work that involves, in general, some significant workload with analyzing assembly/BNIL.
What concept or API needs more documentation?
The usage of BinaryNinja::BackgroundTask to create concurrent background tasks that prevent locks in the UI and allow plugins to execute in parallel (or if not in parallel by a user control thread in the form of Binary Ninja worker), and in general terms, how should we approach multithreading on the low-level APIs (Rust, C++, etc.)?
Is this documentation related to a specific API?
C++ and Rust, as the Python API seems to be able to achieve feats like this, but my focus mainly lies on the C++ API, as it is the one I'm trying to develop plugins in.
Are there any known examples of people using this API/concept?
Whilst I suppose there have been attempts, all public C++ Binary Ninja plugins I have seen so far have never written code that does not lock the UI for a task. This is damaging in some cases, more considering that other APIs such as the Python API appear to be able to do such feat.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the documented BinaryNinja::BackgroundTask, BinaryNinja::RunOnMainThreadAndWait, and related functions, along with the C++ and Rust API material mentioned in the issue. Done means providing clear guidance and examples for safe background work, UI synchronization, and plugin workloads without locking the UI.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- developer-experience, documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100