From 53a232f4fb58ba7edaf67c6c506924f80b99b22d Mon Sep 17 00:00:00 2001 From: davidmacdonald80 Date: Wed, 15 May 2024 16:50:28 -0500 Subject: [PATCH] a change i made last night --- src/alarm.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/alarm.py b/src/alarm.py index a4547a6..d44bfe6 100644 --- a/src/alarm.py +++ b/src/alarm.py @@ -219,14 +219,17 @@ def main(self): if __name__ == "__main__": - ac1 = AlarmClock(alarm_time="6:05", only_weekdays=True, volume_level=70) - ac2 = AlarmClock(alarm_time="20:41", only_weekdays=True, volume_level=85) + threads = [] + clocks = [] + clocks.append(AlarmClock(alarm_time="6:05", only_weekdays=True, volume_level=70)) + # clocks.append(AlarmClock(alarm_time="23:17", only_weekdays=True, volume_level=85)) - thread1 = Thread(target=ac1.main) - thread2 = Thread(target=ac2.main) + for clock in clocks: + thread = Thread(target=clock.main) + threads.append(thread) - thread1.start() - thread2.start() + for thread in threads: + thread.start() - thread1.join() - thread2.join() + for thread in threads: + thread.join()