Python | os.WIFCONTINUED() method
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.WIFCONTINUED()
method in Python is used to check whether a process has been continued from a job control stop or not. This method takes process status code as returned by os.wait()
, os.system()
or os.waitpid()
method as a parameter and returns True if the process has been stopped, otherwise returns False.
Syntax: os.WIFCONTINUED(status)
Parameter:
status: This parameter takes process status code (an integer value) as returned by os.system(), os.wait() or os.waitpid() method.
Return type: This method returns a boolean value of class ‘bool’. This method returns True if the process has been continued from a job control stop, otherwise returns False.
Code: Use of os.WIFCONTINUED()
method
import os, signal
pid = os.fork()
if pid :
os.kill(pid, signal.SIGSTOP)
os.kill(pid, signal.SIGCONT)
info = os.waitpid(pid, os.WCONTINUED)
print ( "\nIn parent process" )
continued = os.WIFCONTINUED(info[ 1 ])
print ( "Has child process been continued from a job control stop?" )
print (continued)
else :
print ( "In Child process" )
print ( "Process ID:" , os.getpid())
print ( "Hello ! Geeks" )
|
Output:
In Child process
Process ID: 12371
Hello! Geeks
In parent process
Has child process been continued from a job control stop?
True
References: https://docs.python.org/3/library/os.html#os.WIFCONTINUED
Last Updated :
26 Aug, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...