diff options
| author | Rusty Wagner <rusty@vector35.com> | 2016-08-18 19:28:22 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2016-08-18 19:28:22 -0400 |
| commit | e29b88a95e41aeb579b4d3bbfc0869acf1282c8b (patch) | |
| tree | de03cadfa51fa0d38852e36640aa20a3abea9ae7 /binaryninjaapi.h | |
| parent | 228ee0e979268afab31b66efb357f2236238751d (diff) | |
Add API to execute code on the main thread
Diffstat (limited to 'binaryninjaapi.h')
| -rw-r--r-- | binaryninjaapi.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index c8d54c18..d3234dcc 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -273,6 +273,8 @@ namespace BinaryNinja class Platform; class Type; class DataBuffer; + class MainThreadAction; + class MainThreadActionHandler; /*! Logs to the error console with the given BNLogLevel. @@ -365,6 +367,10 @@ namespace BinaryNinja Type** outType, std::vector<std::string>& outVarName); + void RegisterMainThread(MainThreadActionHandler* handler); + Ref<MainThreadAction> ExecuteOnMainThread(const std::function<void()>& action); + void ExecuteOnMainThreadAndWait(const std::function<void()>& action); + class DataBuffer { BNDataBuffer* m_buffer; @@ -2153,4 +2159,20 @@ namespace BinaryNinja CoreScriptingProvider(BNScriptingProvider* provider); virtual Ref<ScriptingInstance> CreateNewInstance() override; }; + + class MainThreadAction: public CoreRefCountObject<BNMainThreadAction, + BNNewMainThreadActionReference, BNFreeMainThreadAction> + { + public: + MainThreadAction(BNMainThreadAction* action); + void Execute(); + bool IsDone() const; + void Wait(); + }; + + class MainThreadActionHandler + { + public: + virtual void AddMainThreadAction(MainThreadAction* action) = 0; + }; } |
