MCPcopy Create free account
hub / github.com/DasyDong/developer-roadmap / MyThread

Class MyThread

code/thread.py:3–13  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import threading
2import time
3class MyThread(threading.Thread):
4 def run(self):
5 global num
6 time.sleep(5)
7
8 if mutex.acquire(1):
9
10 num +=1
11 msg = self.name + 'set num to ' +str(num)
12 print(msg)
13 mutex.release()
14num = 0
15mutex = threading.Lock()
16def test():

Callers 1

testFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected