This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace bamthread | |
{ | |
typedef std::unique_ptr<boost::asio::io_service::work> asio_worker; | |
// the actual thread pool | |
struct ThreadPool { | |
ThreadPool(size_t threads) :service(), working(new asio_worker::element_type(service)) { | |
for ( std::size_t i = 0; i < threads; ++i ) { | |
auto worker = boost::bind(&boost::asio::io_service::run, &(this->service)); | |
g.add_thread(new boost::thread(worker)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm init -y | |
yarn add --dev typescript ts-node nodemon @types/node | |
npx tsc --init --outDir Dist | |
touch index.ts | |
npx npm-add-script -k dev -v "nodemon index.ts" | |
npx npm-add-script -k start -v "ts-node index.ts" | |
mkdir .vscode | |
echo '{ "editor.formatOnSave": true }' > .vscode\settings.json |