Commit 08d49196 authored by Mathieu STEFANI's avatar Mathieu STEFANI

Fixed compilation for gcc 4.7

parent fc806ccc
...@@ -1059,10 +1059,10 @@ namespace Async { ...@@ -1059,10 +1059,10 @@ namespace Async {
void wait() { void wait() {
if (promise_.isFulfilled() || promise_.isRejected()) return; if (promise_.isFulfilled() || promise_.isRejected()) return;
promise_.then([&](const T&) { promise_.then([&](const T&) mutable {
std::unique_lock<std::mutex> guard(mtx); std::unique_lock<std::mutex> guard(mtx);
cv.notify_one(); cv.notify_one();
}, [&](std::exception_ptr) { }, [&](std::exception_ptr) mutable {
std::unique_lock<std::mutex> guard(mtx); std::unique_lock<std::mutex> guard(mtx);
cv.notify_one(); cv.notify_one();
}); });
...@@ -1075,10 +1075,10 @@ namespace Async { ...@@ -1075,10 +1075,10 @@ namespace Async {
std::cv_status wait_for(const std::chrono::duration<Rep, Period>& period) { std::cv_status wait_for(const std::chrono::duration<Rep, Period>& period) {
if (promise_.isFulfilled() || promise_.isRejected()) return std::cv_status::no_timeout; if (promise_.isFulfilled() || promise_.isRejected()) return std::cv_status::no_timeout;
promise_.then([&](const T&) { promise_.then([&](const T&) mutable {
std::unique_lock<std::mutex> guard(mtx); std::unique_lock<std::mutex> guard(mtx);
cv.notify_one(); cv.notify_one();
}, [&](std::exception_ptr) { }, [&](std::exception_ptr) mutable {
std::unique_lock<std::mutex> guard(mtx); std::unique_lock<std::mutex> guard(mtx);
cv.notify_one(); cv.notify_one();
}); });
......
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
// it in our own thread so that we make sure that every I/O operation happens in the right thread // it in our own thread so that we make sure that every I/O operation happens in the right thread
const bool isInRightThread = std::this_thread::get_id() == io()->thread(); const bool isInRightThread = std::this_thread::get_id() == io()->thread();
if (!isInRightThread) { if (!isInRightThread) {
return Async::Promise<ssize_t>([=](Async::Deferred<ssize_t> deferred) { return Async::Promise<ssize_t>([=](Async::Deferred<ssize_t> deferred) mutable {
BufferHolder holder(buffer); BufferHolder holder(buffer);
auto detached = holder.detach(); auto detached = holder.detach();
WriteEntry write(std::move(deferred), detached, flags); WriteEntry write(std::move(deferred), detached, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment