IoService included
This commit is contained in:
1 parent
407ee3868f
commit
61ada33ee1
3 files changed
+36
-50
No files matched your search
+18
-10
@@ -24,23 +24,31 @@ namespace SE
|
||||
|
||||
void PerformInMainThreadAsync(boost::function<void()> f)
|
||||
{
|
||||
/*
|
||||
|
||||
if (boost::this_thread::get_id() == ResourceManager->MainThreadId)
|
||||
{
|
||||
f();
|
||||
}
|
||||
else
|
||||
{
|
||||
ResourceManager->MainThreadAsyncFunctionArr.push_back(f);
|
||||
}*/
|
||||
if (boost::this_thread::get_id() == ResourceManager->MainThreadId)
|
||||
{
|
||||
f();
|
||||
}
|
||||
else
|
||||
{
|
||||
MainThreadIoService.post(f);
|
||||
|
||||
boost::mutex serviceLock;
|
||||
|
||||
boost::function<void()> func =
|
||||
[&f, &serviceLock] ()
|
||||
{
|
||||
f();
|
||||
serviceLock.unlock();
|
||||
};
|
||||
|
||||
|
||||
serviceLock.lock();
|
||||
MainThreadIoService.post(func);
|
||||
|
||||
serviceLock.lock();
|
||||
serviceLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user