当前位置:网站首页>Comparison between channel and lock in go question bank · 10

Comparison between channel and lock in go question bank · 10

2022-06-22 12:11:00 GolangRoadmap

*

title GOLANG ROADMAP Community

*

answer (engine)

Concurrency problems can be solved with channel The solution can also be used Mutex solve , But they are good at solving different problems .

channel The focus is on the data flow of concurrency , It is applicable to scenarios where data flows in multiple processes .

and mutex The focus is on data immobility , Only one process is allowed to access data for a certain period of time , It is applicable to scenarios where the data location is fixed .

原网站

版权声明
本文为[GolangRoadmap]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221131467795.html