OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.get_blocking() method in Python is used to get the blocking mode information of the specified file descriptor.
This method returns True if the os.O_NONBLOCK flag is unset which means that the specified file descriptor is in blocking mode and False if the os.O_NONBLOCK flag is set which means that the specified file descriptor is in non-blocking mode.
A file descriptor in blocking mode means that I/O system calls like read, write, or connect can be blocked by the system.
For example: If we call read system call on stdin then our program will get blocked (the kernel will put the process into the sleeping state) until data to be read is actually available on stdin.
os.get_blocking() method is available on Unix platforms only.
fd: A file descriptor whose blocking mode information is required.
Return Type: This method returns a Boolean value of class ‘bool’. True denotes that the file descriptor is in blocking mode while False denotes that the file descriptor is in non-blocking mode.
File desciptor is in blocking mode
- class method vs static method in Python
- Python | os.dup() method
- Python | next() method
- Python | set() method
- Python | os.uname() method
- Python | os.fsdecode() method
- Python | os.getpid() method
- Python | os.getlogin() method
- Python | os.getenv() method
- Python | os.getcwd() method
- Python | os.truncate() method
- Python | os.listdir() method
- Python | sympy.apart() method
- Python | sympy.sin() method
- Python | os.makedev() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.