aboutsummaryrefslogtreecommitdiff
path: root/challenge-142/lubos-kolouch/python/ch-2.py
blob: fc7e601a16706a2d49353c7faaa4e58ecb8930b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import threading
import time


def sleep_sort_value(n):
    time.sleep(n)
    print(n, end=' ')


def sleep_sort(numbers):
    threads = []

    for n in numbers:
        thread = threading.Thread(target=sleep_sort_value, args=(n,))
        thread.start()
        threads.append(thread)

    for thread in threads:
        thread.join()


sleep_sort([3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5])