mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-22 17:12:55 +08:00
20 lines
304 B
Python
20 lines
304 B
Python
import _thread
|
|
import time
|
|
|
|
|
|
class Test:
|
|
_val = 1
|
|
|
|
def __init__(self):
|
|
self._val = 2
|
|
_thread.start_new_thread(self.init, ())
|
|
|
|
def init(self):
|
|
print('self._val:', self._val)
|
|
self._val = 3
|
|
|
|
test = Test()
|
|
while test._val != 3:
|
|
time.sleep(0.1)
|
|
time.sleep(0.1)
|