Am 09.10.2017 um 14:18 schrieb Markus:

Hi!

I was wondering if it's legal to use TCPConnection.write in several tasks, like:

TCPConnection myConnection;
runTask({
   myConnection.write(lotsOfData0);
});
myConnection.write(lotsOfData1);

will this mean that first lotsOfData0 or lotsOfData1 will get send and then the other one, or will it result in, some bytes of lotsOfData0, then some bytes lotsOfData1 will get send, and so on?

I couldn't find any documentation or search results on that topic, would you mind pointing me to the right direction,
thx Markus

Currently, concurrent writes are forbidden and will usually lead to an
assertion failure. A TaskMutex needs to be used to ensure exclusive
access. The same applies also to concurrent reads.

However, in later versions of eventcore (which will be the default event
loop abstraction), it is planned to enqueue reads and writes in the
order in which they get initiated, so the code above would become legal.
Under the normal semantics, lotsOfData0 would then be sent first, as
runTask will eagerly start to execute the task before returning after
the first yield/blocking operation occurred.