In the context of boost::asio, what is the metaphor behind the term “strand”?

半世苍凉 提交于 2021-02-05 05:55:11

问题


As a French native, and a boost::asio user, I have added the 'strand' word to my vocabulary (is a 'toron' in French), here an image of a rope made of three strands, an each one made of multiple others:
enter image description here
But I do not understand the metaphor used by Christopher Kohlhoff, do you ?


回答1:


A strand is a logical, sequential path.

Even if many paths intertwine, the paths are continuous and unbroken, and logically distinct.

This is what makes the metaphor work: even though many strands can be intertwined (on many threads, even), the "logical path of code" is never broken, interrupted or collided with another strand

enter image description here

Actually the picture in the question is pretty descriptive and more typical than this, because indeed you will have a limited number of strands doing - typically - similar work in a single direction (forward in time) and in fair alternation (io_service is responsible for scheduling tasks for each strand).



来源:https://stackoverflow.com/questions/28669840/in-the-context-of-boostasio-what-is-the-metaphor-behind-the-term-strand

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!