Python - Simple and Elegant! Event-based
Solution:\n\nfrom threading import Event\n\nclass Foo:\n    def __init__(self):\n        self.event1, self.event2 = Event(), Event()\n\n    def first(self, f):\
**Solution**:\n```\nfrom threading import Event\n\nclass Foo:\n    def __init__(self):\n        self.event1, self.event2 = Event(), Event()\n\n    def first(self, f):\n        f()\n        self.event1.set()\n\n    def second(self, f):\n        self.event1.wait()\n        f()\n        self.event2.set()\n\n    def third(self, f):\n        self.event2.wait()\n        f()\n```
['Python', 'Python3']