Sogou【同构】可对标taskflow的并行计算,网络请求并串发库 GitHub - sogou/workflow: C Parallel Computing and Asynchronous Networking Framework示例代码#include stdio.h#include workflow/WFHttpServer.h#include mutex#include condition_variable#include chrono#include workflow/WFAlgoTaskFactory.h#include atomic#include workflow/WFTaskFactory.h#include workflow/WFFacilities.h#pragma comment(lib, ws2_32.lib)#pragma comment(lib, libssl.lib)#pragma comment(lib, libcrypto.lib)#pragma comment(lib, Mswsock.lib)static void __arr_init(int* arr, int n){srand(time(NULL));for (int i 0; i n; i)arr[i] rand() % 65536;}void parallelSort() {static constexpr int n 100000;int* arr new int[n];__arr_init(arr, n);std::mutex mutex;std::condition_variable cond;bool done false;auto* task WFAlgoTaskFactory::create_psort_task(psort, arr, arr n, [mutex, cond, done](WFSortTaskint* task) {int* first task-get_input()-first;int* last task-get_input()-last;mutex.lock();done true;mutex.unlock();cond.notify_one();});task-start();std::unique_lockstd::mutex lock(mutex);while (!done)cond.wait(lock);lock.unlock();delete[]arr;}static SubTask* create_task(int target){static std::atomicint generator;return WFTaskFactory::create_timer_task(0, [](WFTimerTask*){target generator;});}void graphTask() {WFFacilities::WaitGroup wait_group(1);auto graph WFTaskFactory::create_graph_task([wait_group](WFGraphTask*) { wait_group.done(); });constexpr int N 4096 - 1;auto target new int[N];auto node new WFGraphNode * [N];for (int i 0; i N; i)node[i] graph-create_graph_node(create_task(target[i]));for (int i 1; i N; i)node[i]-precede(*node[(i - 1) / 2]);graph-start();wait_group.wait();delete[] target;delete[] node;}int test(){parallelSort();graphTask();WFHttpServer server([](WFHttpTask* task) {task-get_resp()-append_output_body(htmlHello World!/html});if (server.start(8888) 0) { // start server on port 8888getchar(); // press Enter to end.server.stop();}return 0;}GitHub - NVIDIA/thrust: [ARCHIVED] The C parallel algorithms library. See https://github.com/NVIDIA/cccl创作不易小小的支持一下吧