Jean Davy
Jean Davy

Reputation: 2240

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

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 ?

Upvotes: 4

Views: 523

Answers (1)

sehe
sehe

Reputation: 393537

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).

Upvotes: 4

Related Questions