Event loop

Signed-off-by: leo-ma <begeekmyfriend@gmail.com>