Python 3.2는 sys.setswitchinterval
을 노출하는 Antoine Pitrou의 new GIL implementation을 소개했습니다.sys.setswitchinterval in Python 3.2 이상
언제 이것을 변경하면 유용할까요? 그 이유는 무엇입니까? 또 다른 사용 사례 당신이 convoy effect (또는 가장자리에 직면 해 코드 특별히 조정됩니다
sw_interval = sys.getswitchinterval()
try:
# Setting the switch interval to a very big number to make sure that their will be no
# thread context switching while running the operations that came after.
sys.setswitchinterval(sys.maxint)
# Expressions run here will be atomic ....
finally:
sys.setswitchinterval(sw_interval)
:
수취인 없음! 50 번 담당자가 한 번 ... –