Am I getting lost on the difference between posting using strand :: wrap and strand :: post? Both seem to guarantee serialization, but how can you serialize with wrap and not get sequential order? Looks like they both had to do the same. When will I use one over the other?
Here is a bit more verbose pseudo code:
mystrand(ioservice); mystrand.post(myhandler1); mystrand.post(myhandler2);
this ensures that my two handlers are serialized and executed in order even in the thread pool.
Now how is this different from the bottom?
ioservice->post(mystrand.wrap(myhandler1)); ioservice->post(mystrand.wrap(myhandler2));
Looks like they are doing the same? Why use one over the other? I see that both are used, and I'm trying to figure out when one makes more sense than the other.
source share