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

Method run

code/thread.py:4–13  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected