28 #ifndef YSL_INC_Core_yapp_h_
29 #define YSL_INC_Core_yapp_h_ 1
32 #include YFM_YSLib_Core_YShell
33 #if YF_Multithread == 1
40 using Messaging::MessageQueue;
48 #if YF_Multithread == 1
54 std::recursive_mutex queue_mutex;
95 template<typename _fCallable>
97 AccessQueue(_fCallable
f) -> decltype(
f(qMain))
99 #if YF_Multithread == 1
100 std::lock_guard<std::recursive_mutex> lck(queue_mutex);
113 OnGotMessage(
const Message&)
override;
125 Switch(shared_ptr<Shell>&)
ynothrow;
132 PDefH(
bool, Switch, shared_ptr<Shell>&& h) ynothrow
151 inline shared_ptr<Shell>
166 YAssert(
bool(hShl),
"Null shell handle found.");
198 template<Messaging::MessageID _vID>
YF_API Application & FetchAppInstance() ynothrow
取应用程序实例。
YF_API void PostMessage(const Message &, Messaging::Priority) ynothrow
全局默认队列消息发送函数。
YF_API void PostQuitMessage(int nExitCode, Messaging::Priority p=0xF0)
以优先级 p 发起 Shell 终止请求,返回 nExitCode。
shared_ptr< Shell > FetchShellHandle() ynothrow
取当前应用程序线程空间中活动的 Shell 句柄。
std::function< void()> ApplicationExit
资源释放函数。
shared_ptr< Shell > hShell
当前 Shell 句柄:指示当前线程空间中运行的 Shell 。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
bool Activate(const shared_ptr< Shell > &hShl)
激活 Shell 对象:控制权转移给此对象以维持单线程运行。
DefGetter(const ynothrow, shared_ptr< Shell >, ShellHandle, hShell) template< typename _fCallable > auto AccessQueue(_fCallable f) -> decltype(f(qMain))
取得线程空间中当前运行的 Shell 的句柄。
#define YAssert(_expr, _msg)
bool Switch(shared_ptr< Shell > &) ynothrow
线程切换:若参数非空,和线程空间中当前运行的 Shell 的句柄交换。