2010年12月30日 星期四

[Python] Threading Sample - 執行緒範例

每一秒加一個Thread

每一個Thread Sleep 10 seconds

Result:
sleeping 10 sec from thread 0
sleeping 10 sec from thread 1
sleeping 10 sec from thread 2
sleeping 10 sec from thread 3
sleeping 10 sec from thread 4
sleeping 10 sec from thread 5
sleeping 10 sec from thread 6
sleeping 10 sec from thread 7
sleeping 10 sec from thread 8
sleeping 10 sec from thread 9
finished sleeping from thread 0
finished sleeping from thread 1
finished sleeping from thread 2
finished sleeping from thread 3
finished sleeping from thread 4
finished sleeping from thread 5
finished sleeping from thread 6
finished sleeping from thread 7
finished sleeping from thread 8
finished sleeping from thread 9


Source Code:
Related Posts Plugin for WordPress, Blogger...