20 lines
285 B
C++
20 lines
285 B
C++
#include <iostream>
|
|
#include <future>
|
|
#include "ThreadPool.h"
|
|
|
|
using namespace std;
|
|
|
|
int sum1(int a, int b) {
|
|
return a + b;
|
|
}
|
|
|
|
int main() {
|
|
ThreadPool pool;
|
|
pool.start();
|
|
future<int> res = pool.submitTask(sum1, 10, 20);
|
|
|
|
cout << res.get() << endl;
|
|
|
|
return 0;
|
|
}
|