27 Aug
2012
27 Aug
'12
5:53 p.m.
Q1: If I call async_write while there is a pending async_read_some in a single-threaded environment, can the write complete before the read completes? (i.e. will I need to receive some data before the write goes out?)
Q2: Same question, but if I am using strand to serialize the operations.
In the both case the read and write and independent, so you can't know which completes first. Strand only serializes handler invocations, but you can't know when the handlers are enqueued.