IoService included

This commit is contained in:
vladislav.khorev committed 2013-02-21 08:35:47 +00:00
1 parent 407ee3868f
commit 61ada33ee1
3 files changed
+36 -50

No files matched your search

+18 -10
View File
@@ -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();
}
}