36 lines
606 B
Python
36 lines
606 B
Python
from concurrent import interpreters
|
|
from libspeedup import my_stat_counter
|
|
|
|
|
|
def calc():
|
|
my_stat_counter(2)
|
|
my_stat_counter(2)
|
|
a = my_stat_counter(2)
|
|
print(a)
|
|
|
|
|
|
def main():
|
|
my_stat_counter(1)
|
|
my_stat_counter(1)
|
|
int1 = interpreters.create()
|
|
int2 = interpreters.create()
|
|
int3 = interpreters.create()
|
|
|
|
t1 = int1.call_in_thread(calc)
|
|
t2 = int2.call_in_thread(calc)
|
|
t3 = int3.call_in_thread(calc)
|
|
|
|
t1.join()
|
|
t2.join()
|
|
t3.join()
|
|
|
|
int1.close()
|
|
int2.close()
|
|
int3.close()
|
|
|
|
print(my_stat_counter(1))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|