/
niceSOFT
/
swig
Обзор
Документация
Войти
/
niceSOFT
/
swig
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Examples/test-suite/python/director_guard_runme.py
32 строки
693 B
Erez Geva
Add test to director guard using multiple threads.
12 июл 2024, 20:54
12 июл 2024, 20:54
3dfd65e
Код
Авторство
О чём код?
import director_guard import threading import time str2 = "tst2" class MinCallback(director_guard.Callback): def run(self): return str2 class CallThread(threading.Thread): def __init__(self, caller): super(CallThread, self).__init__() self.caller = caller def run(self): for x in range(100): if self.caller.call() != "tst2": raise RuntimeError("Should return true") time.sleep(0.001) # 1 millisecond callback = MinCallback() caller = director_guard.Caller(callback) threads = [ ] for x in range(10): threads.append(CallThread(caller)) for t in threads: t.start() for t in threads: t.join()