From fdbddaa4873fda6e83b8894dd58f166ebde795c3 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Fri, 2 Aug 2013 10:36:31 -0700 Subject: Refining a bit more the Future class. --- src/Handle.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/Handle.cc') diff --git a/src/Handle.cc b/src/Handle.cc index 361561a..cc39f41 100644 --- a/src/Handle.cc +++ b/src/Handle.cc @@ -96,14 +96,11 @@ ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count, Events::BaseE Balau::Future Balau::Handle::readU8() { IO t(this); - auto func = [t]() mutable -> uint8_t { - uint8_t r; - t->read(&r, 1); - return r; - }; - Future r; - r.m_run = func; - return r; + return Future([t]() mutable { + uint8_t b; + t->read(&b, 1); + return b; + }); } void Balau::Handle::rseek(off_t offset, int whence) throw (GeneralException) { -- cgit v1.2.3