Multithreading in Python

  • It can temporarily be put on hold (also known as sleeping) while other threads are running — this is called yielding.
  • threading.currentThread() − Returns the number of thread objects in the caller’s thread control.
  • threading.enumerate() − Returns a list of all thread objects that are currently active.
  • start() − The start() method starts a thread by calling the run method.
  • join([time]) − The join() waits for threads to terminate.
  • isAlive() − The isAlive() method checks whether a thread is still executing.
  • getName() − The getName() method returns the name of a thread.
  • setName() − The setName() method sets the name of a thread.
  • Override the __init__(self [,args]) method to add additional arguments.
  • Then, override the run(self [,args]) method to implement what the thread should do when started.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store