Python, eat & wait, queue | condition
1 eat 4 wait:\n\npython []\nclass DiningPhilosophers:\n    \n    actions = []\n        \n    def wantsToEat(self, idx, *actions):\n        self.actions += actio
1 eat 4 wait:\n\n```python []\nclass DiningPhilosophers:\n    \n    actions = []\n        \n    def wantsToEat(self, idx, *actions):\n        self.actions += actions\n        [*map(lambda _: self.actions.pop(0)(), actions)]\n```\n\neat together:\n\n```python []\nimport threading\n\nclass DiningPhilosophers:\n    \n    def __init__(self):\n        self.c = threading.Condition()\n        self.d = [{0, 7, 8}, {0, 8, 9}, {0, 9, 5}, {0, 5, 6}, {0, 6, 7}]\n        self.t = 0\n        \n    def wantsToEat(self, idx, *actions):\n        with self.c:\n            self.c.wait_for(lambda: self.t in self.d[idx])\n            self.t += idx + 5\n            self.c.notify_all()\n        [*map(lambda func: func(), actions)]\n        with self.c:\n            self.t -= idx + 5\n            self.c.notify_all()\n```
['Python3']