Hi, i
n my scenario, I need to initiate writing to the stream from my application thread when the data is ready. It is unclear what to do in situations that lead to the RPC closing and the OnDone call at the end.
> Thread safety: the above calls may take place concurrently, except that
OnDone will always take place after all other reactions. No further RPC operations are permitted to be issued after OnDone is invoked.
> There's no requirement that `StartWrite()` can be called only from a reactor thread -- you can call that from anywhere, as long as you have proper synchronization. The only requirement is that there can be only one write pending at a time.
But how to synchronize the StartWrite call from the user thread with the OnDone call from the reactor thread ? Is this even possible?
P.S. experiments show that if StartWrite is called after entering OnDone and we wait for OnWriteDone to be called while we are in OnDone, it is still UB, since OnWriteDone will be followed by
MayBeDone