Skip to content
Advertisement

Multithreading on object methods in python

I am trying to implement multi threading with oops

JavaScript

But the test1.printHi is expecting me to pass self

JavaScript

After passing self it is not being multi threaded any more It

JavaScript

Its first printing all hi and then hello at last next is getting printed but when I implement them like functions its working properly they are getting printed at once combined. Whats the right way to implement it properly such that both threads runs simultaneously…

Advertisement

Answer

You seem to be passing an extra 10 to the methods; try:

JavaScript

Or, if you want to keep the parameter, the functions need to accept it:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement