1 #if !defined(_BTK_HPP_) 9 #include "impl/invoker.hpp" 13 typedef bool(*ExceptionHandler)(std::exception*);
14 BTKAPI ExceptionHandler SetExceptionHandler(ExceptionHandler);
20 BTKAPI
void Exit(
int code = EXIT_SUCCESS);
28 BTKAPI
void AtExit(
void(* fn)(
void*),
void *data);
29 BTKAPI
void AtExit(
void(* fn)());
31 template<
class Callable,
class ...Args>
32 void AtExit(Callable &&callable,Args ...args){
33 auto *invoker =
new Impl::Invoker<Callable,Args...>{
34 {std::forward<Args>(args)...},
35 std::forward<Callable>(callable)
38 void (*fn)(
void*) = Impl::Invoker<Callable,Args...>::Run;
47 BTKAPI
void DeferCall(
void(* fn)(
void*),
void *data);
50 template<
class Callable,
class ...Args>
51 void DeferCall(Callable &&callable,Args ...args){
52 auto *invoker =
new Impl::Invoker<Callable,Args...>{
53 {std::forward<Args>(args)...},
54 std::forward<Callable>(callable)
57 void (*fn)(
void*) = Impl::Invoker<Callable,Args...>::Run;
BTKAPI bool CouldBlock()
Check is not the main thread or Main EventLoop is not running.
Definition: core.cpp:436
This header include many useful containers.
Definition: async.hpp:7
BTKAPI void DeferCall(void(*fn)(void *), void *data)
This function will be called in main EventLoop.
Definition: core.cpp:421
BTKAPI void Exit(int code=EXIT_SUCCESS)
End the event loop.
Definition: core.cpp:402
BTKAPI bool IsMainThread()
Check is main thread(which call Btk::run)
Definition: core.cpp:433
BTKAPI void AtExit(void(*fn)(void *), void *data)
Regitser atexit callback.
Definition: core.cpp:413
BTKAPI int run()
Enter the EventLoop.
Definition: core.cpp:58