microknights / SplitStream

Split stream into multiple streams that can be read concurrently

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_Finished in ReadAheadChunks does not reach end

PaulSinnema opened this issue · comments

For some reason the ReadAheadChunks sometimes does not reach the _Finished = true; During dispose() that flag is tested and causes an Exception to be thrown. I have no clue what could cause this. Is it possible there is a race condition problem here. The ReadAheachChunks() is a Task being run same as the Parallel tasks being run.

Are you sure that your inputSourceStream has flushed all data?

Do you have an example, or can you describe your input and output streams (socket,file etc..)

I have just reviewed the code. The Dispose should not be called before _finished it is set to true. The StartReadAhead task is completed when _finished == true, so for a test - you could try do a await on the StartReadAhead task and see if it still fails.

But it is threading, so anything is possible ;)

Is it anyway possible for you to show the code?