Skip to content

Instantly share code, notes, and snippets.

@ohoroyoi
Last active June 24, 2019 09:07
Show Gist options
  • Save ohoroyoi/65dbff89baff4e1e7fb5eef9e45763d2 to your computer and use it in GitHub Desktop.
Save ohoroyoi/65dbff89baff4e1e7fb5eef9e45763d2 to your computer and use it in GitHub Desktop.
import time
from threading import Thread
def myfunc(i):
print("sleeping 5 sec from thread %d" % i)
time.sleep(5)
print("finished sleeping from thread %d" % i)
for i in range(10):
t = Thread(target=myfunc, args=(i,)) # 왜 i아니고 i,?? https://docs.python.org/3/library/threading.html#threading.Thread 튜플형이라 함
t.start()
# 그리고 이렇게 thread 구현하는 것보다 celery 쓰는게 좋은 이유는. 만약 뻑나서 죽어도 어디서 죽었는지를 관리해주니까 편해서~ 임.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment