From e29b88a95e41aeb579b4d3bbfc0869acf1282c8b Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 18 Aug 2016 19:28:22 -0400 Subject: Add API to execute code on the main thread --- binaryninjaapi.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'binaryninjaapi.h') 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& outVarName); + void RegisterMainThread(MainThreadActionHandler* handler); + Ref ExecuteOnMainThread(const std::function& action); + void ExecuteOnMainThreadAndWait(const std::function& action); + class DataBuffer { BNDataBuffer* m_buffer; @@ -2153,4 +2159,20 @@ namespace BinaryNinja CoreScriptingProvider(BNScriptingProvider* provider); virtual Ref CreateNewInstance() override; }; + + class MainThreadAction: public CoreRefCountObject + { + public: + MainThreadAction(BNMainThreadAction* action); + void Execute(); + bool IsDone() const; + void Wait(); + }; + + class MainThreadActionHandler + { + public: + virtual void AddMainThreadAction(MainThreadAction* action) = 0; + }; } -- cgit v1.3.1