
18 Nov
2009
18 Nov
'09
3:10 p.m.
It does make sense, if the handler is a lightweight copiable object.
What if the handler take so much time in execution?
I don't understand how the execution time is relevant for this issue. Your handler must outlive your async. event, i.e. the object you pass to async_write must be alive when the write operation is complete. You can achive this in various ways, among them - by passing a smart pointer to a heap-allocated object, or by passing an object by-value.