add multi-thread support, add event support