Add a lock/unlock pair inside the event callbacks in bufferevents. This fixes part of bug 2800642, I believe, though there is still a general race condition in multithreaded use of events that we need to think about. svn:r1337