Multithread filter how to write to the same buffer

You are find a patch which adds a lock here:

And another similar discussion to this type of issue here: