rough design of pluggable event loop algorithm