[JAVA] 21. ์ฐ๋ ๋ ์คํ ์ ์ด ๋ฉ์๋(sleep ,interrupt, stop, suspend, resume, join, yield)
https://hyejin.tistory.com/594 [JAVA] 20. ์ฐ๋ ๋ Thread 1๏ธโฃ ํ๋ก์ธ์ค์ ์ฐ๋ ๋ ํ๋ก์ธ์ค Process๋ '์คํ์ค์ธ ํ๋ก๊ทธ๋จ'์ด๋ค. ํ๋ก๊ทธ๋จ์ ์คํํ๋ฉด os ๋ก๋ถํฐ ์คํ์ ํ์ํ ์์(๋ฉ๋ชจ๋ฆฌ)๋ฅผ ํ ๋น๋ฐ์ ํ๋ก์ธ์ค๊ฐ ๋๋ค. ํ๋ก์ธ์ค๋ ํ๋ก๊ทธ๋จ์ ์ํํ hyejin.tistory.com 1๏ธโฃ sleep(long mills) : ์ผ์ ์๊ฐ๋์ ์ฐ๋ ๋๋ฅผ ๋ฉ์ถ๊ฒ ํ๋ค. sleep()์ ์ํด ์ผ์์ ์ง ์ํ๊ฐ ๋ ์ฐ๋ ๋๋ ์ง์ ๋ ์๊ฐ์ด ๋ค ๋๊ฑฐ๋ interrupt()๊ฐ ํธ์ถ๋๋ฉด (interruptedException ๋ฐ์), ์ ์์ ๊นจ์ด๋ ์คํ๋๊ธฐ ์ํ๊ฐ ๋๋ค. ๊ทธ๋์ sleep()์ ํธ์ถํ ๋๋ ํญ์ try-catch๋ฌธ์ผ๋ก ์์ธ๋ฅผ ์ฒ๋ฆฌํด์ค์ผ ํ๋ค. -> th1์ด ๊ฐ์ฅ ๋จผ์ ์ข
..
2022.05.29