Using shared buffer for all threads