Description
Some algorithms can have more efficient implementations if they know that the scheduler that they are scheduling work on can only ever execute one thing at a time. Algorithms can potentially avoid needing to perform synchronization if this is the case.
However, we don't yet have any way of querying on a scheduler whether tasks scheduled on that scheduler can potentially execute concurrently or not.
To facilitate this we should provide such a query. This could either take the form of an is_strand
query on the scheduler, or potentially a more general max_concurrency
query, which callers can then check to see if it's equal to 1.
There may be some cases where a particular algorithm requires a strand-scheduler. We should also consider adding an adapter for a scheduler that returns a new scheduler that is guaranteed to be a strand-scheduler.