๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

์‹œ์Šคํ…œ๊ฐœ๋ฐœ21

[centos7] mariadb port ๋ณ€๊ฒฝ cd /etc/my.cnf.d/ cp server.cnf server.cnf.original vi server.cnf ([mariadb] ํ•˜๋‹จ์— ์ฒ˜์Œ์—ด๋ฉด ์•„๋ฌด๊ฒƒ๋„ ์•ˆ์ ํ˜€์žˆ์Œ. ์•„๋ž˜์ฒ˜๋Ÿผ ๋ณ€๊ฒฝํ•˜๊ณ ์žํ•˜๋Š” ํฌํŠธ๋กœ ์ž…๋ ฅํ›„ ์ €์žฅ) # This group is only read by MariaDB servers, not by MySQL. # If you use the same .cnf file for MySQL and MariaDB, # you can put MariaDB-only options here [mariadb] port=53306 systemctl restart mariadb.service 2022. 9. 20.
[๋น„๋™๊ธฐ] async ์‚ฌ์šฉ๋ฒ• 2 async ์‚ฌ์šฉ๋ฒ• 2 promise, future๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ์ง๊ด€์ ์ด์ง€ ์•Š์„ ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. get_future๋ฅผ ํ•ด์•ผํ•˜๊ณ , set_value๋ฅผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— return๊ฐ’์€ void์ด๋‹ค. async๋ฅผ ์ด์šฉํ•ด์„œ ๋ฐ”๊ฟ”๋ณด์ž. promise, future ์Šคํƒ€์ผ #include #include #include #include using namespace std::chrono_literals; void add(std::promise prms, int n) { prms.set_value(n + 1); } int main() { std::promise prms; std::future fut = prms.get_future(); int num = 3; std::thread t(add, std::move(prms),.. 2022. 6. 16.
[๋น„๋™๊ธฐ] shared_future ์˜ˆ์ œ shared_future๋ฅผ ์‚ฌ์šฉํ•œ ์˜ˆ์ œ future, promise๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ํ•œ์Œ์ด๋‹ค. ํ•˜์ง€๋งŒ promise์˜ ๊ฒฐ๊ณผ๋ฅผ ๋‹ค์ˆ˜์˜ future์—์„œ ๊ณต์œ ํ•˜์—ฌ ๊ฐ’์„ ํ™œ์šฉํ•  ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. ์ด ๋•Œ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด shared_future. #include #include #include #include using namespace std::chrono_literals; void fn(std::shared_future fut) { std::cout 2022. 6. 16.
[๋น„๋™๊ธฐ] promise, future ์‚ฌ์šฉ ์˜ˆ์ œ ๋ฐ ์˜ˆ์™ธ์ฒ˜๋ฆฌ ์ƒํ™ฉ promise, future๋ฅผ ์‚ฌ์šฉํ•œ ์˜ˆ์ œ promise์™€ future๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ด ๋‘˜ ๊ฐ„์— ์ฑ„๋„์ด ์ƒ์„ฑ๋œ๋‹ค. ๋”ฐ๋ผ์„œ ์ด ์ฑ„๋„์€ ํ•˜๋‚˜๋งŒ ์œ ์ง€๋˜์–ด์•ผ ํ•œ๋‹ค. ์“ฐ๋ ˆ๋“œ๋กœ ์ธ์ž๋กœ promise๋ฅผ ๋„˜๊ธธ๋•Œ, ๋‹จ์ˆœํžˆ promise๋ฅผ ๋„˜๊ธฐ๋ฉด copyํ•œ๋‹ค๋Š” ๋œป์ด๋ฉฐ ์ด๋Š” 1:1์˜ ์ฑ„๋„ ๊ด€๊ณ„๊ฐ€ ์–ด๊ธ‹๋‚จ์„ ๋œปํ•œ๋‹ค. ๊ทธ๋ž˜์„œ std::move๋ฅผ ์ด์šฉํ•˜์—ฌ r-value๋กœ ์ธ์ž๋ฅผ ๋„˜๊ฒจ์ค€๋‹ค. #include #include #include using namespace std::chrono_literals; void fn(std::promise prm) { std::this_thread::sleep_for(2s); prm.set_value(33); } int main() { std::promise prm; std::future fut =.. 2022. 6. 16.