| 53 | |
| 54 | template <typename R> |
| 55 | Future<R> run(R (*method)()) |
| 56 | { |
| 57 | std::shared_ptr<lambda::function<R()>> thunk( |
| 58 | new lambda::function<R()>( |
| 59 | lambda::bind(method))); |
| 60 | |
| 61 | std::shared_ptr<Promise<R>> promise(new Promise<R>()); |
| 62 | Future<R> future = promise->future(); |
| 63 | |
| 64 | terminate(spawn(new internal::ThunkProcess<R>(thunk, promise), true)); |
| 65 | |
| 66 | return future; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | #define TEMPLATE(Z, N, DATA) \ |