added includes for locking and changed const size 4096->1000 so no warning