ShannonAI / service-streamer

Boosting your Web Services of Deep Learning Applications.
Apache License 2.0
1.23k stars 186 forks source link

多线程安全 #45

Closed ghost closed 4 years ago

ghost commented 4 years ago

https://github.com/ShannonAI/service-streamer/blob/ebcc3724efc9789feb8980641533909798d4d6dc/service_streamer/service_streamer.py#L102 你好,这个_future_cache在多线程访问时不需要用锁保护下么

Meteorix commented 4 years ago

@wen1q84 你好,python的built-in容器可以当作线程安全的,因为gil的存在。https://docs.python.org/3/glossary.html#term-global-interpreter-lock

ghost commented 4 years ago

https://github.com/ShannonAI/service-streamer/blob/ebcc3724efc9789feb8980641533909798d4d6dc/service_streamer/service_streamer.py#L96 这个task_id为什么要用锁保护呢

Meteorix commented 4 years ago

因为taskid并不是容器类型

wen1q84 notifications@github.com于2019年11月15日 周五下午5:10写道:

https://github.com/ShannonAI/service-streamer/blob/ebcc3724efc9789feb8980641533909798d4d6dc/service_streamer/service_streamer.py#L96 这个task_id为什么要用锁保护呢

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ShannonAI/service-streamer/issues/45?email_source=notifications&email_token=AA5BAXSLDMWZJHM2332SE4DQTZRRLA5CNFSM4JNWT5BKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEEZMVY#issuecomment-554276439, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA5BAXSSQZ2VAPDBDXBYKH3QTZRRLANCNFSM4JNWT5BA .