Apply Ka-Hing Cheung's event_base_got_[break|exit] patch, with locking and whitespace fixes. svn:r1438