Search code examples
pythonselectblock

Does calling Select() block only the thread or the whole program?


I am using select() to check if there is data in a socket with a timeout of 5 seconds. I'm willing to know if calling select() block only the thread or the whole program, if there is no data in the socket, select() will block for 5 seconds only the thread so the rest of the program can run freely or block everything until timeout?


Solution

  • Yes, select will only block the current thread. The other threads can work freely.