Made rolling average filter thread-safe