Multiprocessing.context.Process class

 

Methods of the Process class

process() - The process Constructor

Creates a child process.

run()

This method contains the code that is to be executed as a separate process. This method is similar to the run() method of the Thread class.

start()

Calling start() executes the run method of the process instance.

join()

When called on a process instance it blocks for the specified number of seconds or till the process on which it is called is complete.

is_alive()

Checks whether a process is alive or not and returns the status.

terminate()

Terminates the associated process.

kill()

Kills the associated process.

close()

Closes the process instance

 

Attributes of the Process class

name

The name of the process. It is not unique. Multiple processes can have the same name.

daemon

The daemon status of the process.

pid

Process ID of the process.

exitcode

Exit code of the terminated process.

authkey

The authentication key of the process

sentinel

The numeric handle of the process.

In Unix: This handle can be passed into methods like select(), while waiting for an event.

In Windows: This handle can be used for waitforsingleobject() and waitformultipleobjects().

 


Copyright 2024 © pythontic.com