bloomberg / quantum

Powerful multi-threaded coroutine dispatcher and parallel execution engine
Apache License 2.0
579 stars 95 forks source link

Overload all post member functions for V1 and V2 API #114

Closed accelerated closed 5 years ago

accelerated commented 5 years ago

Signed-off-by: Alexander Damian adamian@bloomberg.net

Describe your changes

Example:

//V1 API
auto func1 = [](CoroContextPtr<std::string> ctx)->int { return ctx->set("HelloWorld!"); }
//V2 API
auto func2 = [](VoidContextPtr)->std::string { return "HelloWorld!"; }

Dispatcher d;
d.post(func1); //ok
d.post(func2); //ok (use overload)
d.post2(func2); //still ok (kept for backward compatibility)

NOTE: forEach, forEachBatch, mapReduce, mapReduceBatch as well as the Sequencer class, still accept only V2 API.

Testing performed Ran unit tests using overloaded dispatch functions.