simple event queue management function