| 86 | |
| 87 | |
| 88 | int main(int argc, char** argv) |
| 89 | { |
| 90 | MyProcess process; |
| 91 | PID<MyProcess> pid = spawn(&process); |
| 92 | |
| 93 | //// -------------------------------------- |
| 94 | |
| 95 | // Future<int> future = dispatch(pid, &MyProcess::func1); |
| 96 | // dispatch(pid, &MyProcess::func2, 42); |
| 97 | |
| 98 | // std::cout << future.get() << std::endl; |
| 99 | |
| 100 | // http::post(pid, "stop"); |
| 101 | |
| 102 | //// -------------------------------------- |
| 103 | |
| 104 | // Promise<bool> p; |
| 105 | |
| 106 | // dispatch(pid, &MyProcess::func1) |
| 107 | // .then([=, &p] (int i) { |
| 108 | // p.set(i == 42); |
| 109 | // return p.future(); |
| 110 | // }) |
| 111 | // .then([=] (bool b) { |
| 112 | // if (b) { |
| 113 | // http::post(pid, "stop"); |
| 114 | // } |
| 115 | // return true; // No Future<void>. |
| 116 | // }); |
| 117 | |
| 118 | // dispatch(pid, &MyProcess::func2, 42); |
| 119 | |
| 120 | //// -------------------------------------- |
| 121 | |
| 122 | // dispatch(pid, &MyProcess::func1); |
| 123 | // dispatch(pid, &MyProcess::func2, 42); |
| 124 | |
| 125 | //// -------------------------------------- |
| 126 | |
| 127 | std::cout << strings::format("Endpoint listening on http://%s/%s/vars\n", |
| 128 | process::address(), |
| 129 | process.self().id).get(); |
| 130 | |
| 131 | wait(pid); |
| 132 | return 0; |
| 133 | } |