multi thread에서 발생할 수 있는 race condition을 해결하기 위한 방법