window로 구현할 때는 아래 예시처럼 if __name__ == '__main__':
문에 freeze_support()
를 넣어주어야 멈추지 않는다.
# for window
from multiprocessing import Process, freeze_support
def f():
print('hello world!')
if __name__ == '__main__':
freeze_support()
Process(target=f).start()
리눅스로 multiprocessing Pool을 구현할 시 아래 코드로 import 하면 멈추지 않는다.
# for linux
import multiprocessing.pool import ThreadPool as Pool