Commit Graph

12 Commits

Author SHA1 Message Date
Gleb Natapov
3f483b22bc future: add missing std::forward() in do_until_continued() 2015-01-06 14:43:34 +02:00
Avi Kivity
f2e25b8442 Merge branch 'shared_ptr'
Split shared_ptr into a traditional polymorphic shared_ptr implementation,
and a lighter-weight, non polymorphic lw_shared_ptr.
2015-01-05 11:29:35 +02:00
Avi Kivity
87f63f7b90 shared_ptr: rename to lw_shared_ptr (for light-weight)
The current shared_ptr implementation is efficient, but does not support
polymorphic types.

Rename it in order to make room for a polymorphic shared_ptr.
2015-01-04 22:38:49 +02:00
Tomasz Grabiec
584139decd future-util: make do_for_each() propagate failure 2014-12-03 20:02:21 +01:00
Tomasz Grabiec
8d48c91a35 future-util: introduce now()
This function belongs to a group of functions for associating futures
with time points. Currently there's only now(), which servers as a shorthand
for make_ready_future<>().
2014-12-03 19:57:43 +01:00
Avi Kivity
e1397038d4 future-util.hh: add missing include
'task_quota' needs reactor.hh
2014-12-01 17:47:28 +02:00
Tomasz Grabiec
f458117b83 core: avoid recursion in keep_doing()
Recursion takes up space on stack which takes up space in caches which
means less room for useful data.

In addition to that, a limit on iteration count can be larger than the
limit on recursion, because we're not limited by stack size here.

Also, recursion makes flame-graphs really hard to analyze because
keep_doing() frames appear at different levels of nesting in the
profile leading to many short "towers" instead of one big tower.

This change reuses the same counter for limiting iterations as is used
to limit the number of tasks executed by the reactor before polling.

There was a run-time parameter added for controlling task quota.
2014-11-20 11:16:09 +02:00
Tomasz Grabiec
7e25d70392 core: introduce map_reduce() utility
It spawns async mapping action in parallel and reduces the results as
they come.
2014-11-11 13:52:23 +02:00
Gleb Natapov
f0416f44b1 keep_doing: remove infinite loop
Prevent keep_doing() from monopolizing the cpu.
2014-11-04 15:19:01 +02:00
Avi Kivity
7f91f1b937 future: add when_all(future...)
when_all(f1, f2) returns a future that becomes ready when all input futures
are ready.  The return value is a tuple with all input futures, so the values
and exceptions can be accessed.
2014-10-30 13:59:17 +02:00
Avi Kivity
6dcf24f98d Move contents of async-action.hh into future-util.hh 2014-10-27 19:28:10 +02:00
Avi Kivity
82321d435f future: add parallel_for_each() helper
Runs functions in paralllel, and returns a future<> that becomes ready
when all are complete.
2014-10-26 13:34:31 +02:00