When you need to access a shared resource -- like a file -- between parallel processes it can be helpful to create another layer of consumer loop that does nothing but file IO. That way you don't have to worry about parallel accesses because technically the file is only being written from one location.
Mike...