Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (47.6k points)

In Python for *nix, does time.sleep() block the thread or the process?

1 Answer

0 votes
by (106k points)

Yes, in Python the time.sleep() function blocks the thread.It allowing other threads to continue to execute while the current one sleeps. You can also test this with a simple python program:

It allows other threads to sleep except in the case where your application has only a single thread, in that case, it will sleep the thread and effectively the process as well.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 7, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...