Control of Event-driven Systems