fixed race condition during starting and stopping records
added doc and refactored
made blocking queue fixed size to reduce malloc calls