from concurrent.futures import ThreadPoolExecutor

def message(message):
    print("Wątek: {}".format(message))

def main():
    print("Utworzenie instancji klasy ThreadPoolExecutor")
    with ThreadPoolExecutor(max_workers=2) as executor:
        future = executor.submit(message, 'komunikat 1')
        future = executor.submit(message, 'komunikat 2')
    print("Wszystkie wątki zakończone")
  
if __name__ == '__main__':
 main()