+ 1

How can I run two functions in parallel inside the same class using python threading?

I want to run two functions in parallel inside python class

18th Jan 2021, 9:39 PM
Karzan
2 Respostas
+ 2
That's unfortunately not what threading is for. I know if might be a bit confusing as a lot of CS and programming definitions talk about how threads can be used for running things and mix together different definitions of concurrency and parallelism. Because of the Global Interoreter Lock no two functions will truly run at the same time with threading. If you want to run things in parallel properly look info multiprocessing.
18th Jan 2021, 11:21 PM
Mateusz Malenta
Mateusz Malenta - avatar
+ 1
Would an example of 2 definitions calling each other whilst encased within a shell definition suit you https://code.sololearn.com/c89T3J2uh3Iz/?ref=app
19th Jan 2021, 2:13 AM
Rik Wittkopp
Rik Wittkopp - avatar