Commit Graph

33 Commits

Author SHA1 Message Date
Avi Kivity
cfeec3799e Add a an asynchronous semaphore class 2014-08-21 13:52:14 +03:00
Avi Kivity
f96b0d5b53 Move pollable_fd_state around
Allows using it inside class reactor.
2014-08-21 13:52:04 +03:00
Avi Kivity
10695644d7 Get rid of regex in http parser
It's slow.  Replacing it doubles throughput to 110K req/s.
2014-08-20 16:37:11 +03:00
Avi Kivity
26527252c5 Remove accept_result 2014-08-20 11:31:01 +03:00
Avi Kivity
b9148304b6 Make future<> and friends a variadic template
This removes the need to create a structure if a future has multiple
return values, and has the nice side effect of removing the specialization
future<void> (replacing it with future<>).
2014-08-20 11:24:32 +03:00
Avi Kivity
8b3690af80 Add apply(func, tuple)
Helper that calls a function with the tuple's components as arguments.
2014-08-20 11:18:23 +03:00
Avi Kivity
2207e8e5f3 Add make_ready_future() helper when no async work needs to be done
Use where applicable.
2014-08-18 16:59:25 +03:00
Avi Kivity
ccb052a418 Speculate epoll results
In many cases, we can guess the result of an epoll_wait() before it happens:
 - if a read() or write() consumes the entire buffer, a following call
   will likely succeed (and if it doesn't, it likely won't)
 - after an accept() completes, a write() will likely succeed

Speculatively add these events to events_known; if we mispredict and
fail with EAGAIN, all we need to do is retry.
2014-08-18 15:52:52 +03:00
Avi Kivity
b9ebc652cb Extract epoll completion handling into a helper 2014-08-18 14:46:02 +03:00
Avi Kivity
96b813fbfc Lazy epoll management
Reduce calls to epoll_ctl() by allowing epoll events that are not
requested by the user, but have still not been satisfied by the system,
to remain installed in epoll.  We may get a spurious wakeup later, but if
we do, we remember it so that when the user does want the event, it will be
ready without a syscall.
2014-08-18 13:04:44 +03:00
Avi Kivity
784b2bf3ed Extract common parts of reactor::readable() and reactore::writeable() into a helper 2014-08-18 12:36:01 +03:00
Avi Kivity
b10da4fa1d Switch epoll_add_int()/epoll_add_out() to future<void>
This integrates better with the rest of the framework, and allows
adding specializations such as likely_readable() easily.
2014-08-18 10:56:36 +03:00
Avi Kivity
c8e04c8cd9 Implement missing future<void> specializations 2014-08-18 10:56:09 +03:00
Avi Kivity
22f0721a39 Implement missing promise<> move assignment 2014-08-18 10:55:43 +03:00
Avi Kivity
ecf989901f future<void> specialization 2014-08-18 00:23:55 +03:00
Avi Kivity
acdf96947c fix promise deleted copy constructor 2014-08-18 00:23:55 +03:00
Avi Kivity
ef749bf26c fix assigning exception to future 2014-08-18 00:23:55 +03:00
Avi Kivity
216ac3cdf0 no need to move() in return stmt 2014-08-17 09:38:42 +03:00
Avi Kivity
1ee08b01ab switch pollable_fd to move semantics 2014-08-15 14:50:46 +03:00
Avi Kivity
c539cdcbee short-circuit then() if future is ready 2014-08-15 01:13:08 +03:00
Avi Kivity
cec55519fe future chaining in httpd (reduces perf?) 2014-08-15 00:35:32 +03:00
Avi Kivity
c7a2417c98 allow futures to be chained: fut.then(...).then(...); 2014-08-15 00:35:11 +03:00
Avi Kivity
3140f14697 future::then() callbacks no longer accept a future 2014-08-14 23:55:11 +03:00
Avi Kivity
1c66118a72 wip 2014-08-14 18:05:11 +03:00
Avi Kivity
b6c91052e2 works 2014-08-14 11:07:17 +03:00
Avi Kivity
7ea696c29e checkpoint 2014-08-14 09:20:03 +03:00
Avi Kivity
919e9c4214 checkpoint 2014-08-12 23:52:23 +03:00
Avi Kivity
c3292aeb63 checkpoint 2014-08-12 22:10:20 +03:00
Avi Kivity
96dab351d4 checkpoin 2014-08-12 18:51:17 +03:00
Avi Kivity
ebc58c56c3 checkpoint 2014-08-12 17:06:18 +03:00
Avi Kivity
1b05c9ab9c checkpoint 2014-08-11 17:59:46 +03:00
Avi Kivity
30b73db070 checkpoint 2014-08-10 19:26:30 +03:00
Avi Kivity
193ac5919d Initial commit 2014-08-10 08:56:33 +03:00