Question: Python 1. Your task for this question is to use what you have learned about how to stop and kill a thread. Develop an example
Python
1. Your task for this question is to use what you have learned about how to stop and kill a thread. Develop an example that involves calling a task function that performs some typical activity, such as a loop that blocks each iteration. If youre stuck for ideas, the task may generate a random number between 0 and 1 then block for a fraction of a second. The first version should wait for the task to complete.
2. Explore different ways to stop the task, such as from within the task with a condition or by raising an exception. Update the example to try triggering the task to stop via an Event. Finally try killing the thread via its parent process. It is important to be familiar and confident with the different ways to stop a new thread as you will almost certainly require this functionality in your own programs.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
