Commit Graph

19 Commits

Author SHA1 Message Date
Avi Kivity
ab7be2890f core: rename distributed<Service> to seastar::sharded<Service>
distributed<> has the connotation of being distributed across the network.
Sharded is more in line with seastar terms.

Keep the distributed<> name and header file as an alias, for
compatibility.
2015-06-22 12:58:56 +03:00
Gleb Natapov
f7f445d563 distributed: deallocate _instance array during stop.
Otherwise tester may crash if _instances destructor is called when thread
responsible for the allocation (which tester spawned to run seastar in)
no longer running.
2015-06-18 14:43:38 +03:00
Avi Kivity
f0ae995817 distributed: document 2015-06-15 23:17:06 +03:00
Tomasz Grabiec
ed3d85d299 foreign_ptr: Use std::pointer_traits<> to get element type 2015-06-07 09:55:33 +03:00
Gleb Natapov
b06f6f8209 foreign_ptr: introduce make_local_and_release()
Sometimes remote data has to be copied to local cpu, but if data is
already local copy can be avoided. Introduce helper function that moves
or copies data depending on origin cpu.
2015-06-04 18:54:05 +03:00
Vlad Zolotarov
db73024f0c core: distributed::local(): check the vector boundaries before trying to access the element
assert() if we are out of bounds or if the element is not initialized.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2015-06-04 14:34:58 +03:00
Avi Kivity
604b13633e distributed: document foreign_ptr<> 2015-06-02 22:37:43 +03:00
Avi Kivity
f3c8994535 distributed: add map_reduce() variant accepting an initial value
Separating the initial value (and accumulator) from the reducer function
can result in simpler invocations.

Unfortunately, the name conflicts with another variant, so we have to name
the method map_reduce0.
2015-05-12 16:57:50 +03:00
Avi Kivity
7cf25ce492 distributed: fix use-after-move
distributed::stop() passes the pointer to the instance being destroyed
by reference, in an attempt to keep things clean (by nulling the pointer
after deleting it).  This is illegal, however, since the lambda is moved
in the bowels of submit_to().  In release mode this is optimized away so
the code works, but in debug mode it leads to a crash.

Fix by capturing by value instead (could also have been fixed by switching
the enclosing capture to a reference).

Credit to Gleb for identifying the problem.
2015-03-30 11:18:16 +03:00
Tomasz Grabiec
8abd982ec9 distributed: Do not move arguments when passing to many cores 2015-03-25 09:39:34 +01:00
Tomasz Grabiec
7bc7951192 core: Use perfect forwarding in invoke_on()/submit_to()
Makes invoking non-copyable lambdas possible:

  distributed<T> t;

  non_copyable_type x;
  t.invoke_on(0, [x = std::move(x)] (auto& t) {});

As a side effect this could save some copyable lambdas from being
needlesly copied.
2015-03-13 19:20:13 +02:00
Tomasz Grabiec
976c9da314 core: Add distributed::map_reduce() version which takes a functor 2015-03-11 13:33:01 +01:00
Tomasz Grabiec
56f6d12bae core: Fix map_reduce() which incorrectly moves away arguments 2015-03-11 13:21:23 +01:00
Avi Kivity
c35b61bda5 distributed: fix return type of lambda-friendly invoke_on()
result_of<> is mean to be used only with its 'type' member; use result_of_t
instead.
2015-02-22 16:20:36 +02:00
Avi Kivity
7f8d88371a Add LICENSE, NOTICE, and copyright headers to all source files.
The two files imported from the OSv project retain their original licenses.
2015-02-19 16:52:34 +02:00
Avi Kivity
b4098dac2f core: add distributed::invoke_on() variants not requiring a pointer to member
Current variants of distributed<T>::invoke_on() require member function to
invoke, which may be tedious to implement for some cases.  Add a variant
that supports invoking a functor, accepting the local instance by reference.
2015-02-18 16:52:56 +02:00
Takuya ASADA
be5568ae31 distributed: handle invoke_on with void return value
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-28 13:48:18 +02:00
Gleb Natapov
7a92efe8d1 core: add local engine accessor function
Do not use thread local engine variable directly, but use accessor
instead.
2015-01-27 14:46:49 +02:00
Takuya ASADA
e1552ad3b6 core: rename smp.hh to distributed.hh
Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-01-14 11:16:09 +02:00