Demo entry 4101043

simple thread in python


Submitted by hirok on Mar 19, 2016 at 20:33
Language: Python. Code size: 237 Bytes.

import time
from threading import Thread

def mythread(i):
	print("sleeping 5 sec in %d" %i)
	print("finished sleeping from %d\n"%i)

for i in range(10):
	t = Thread(target=mythread,args=(i,))

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).