Hello, welcome back.
In this lesson, we're going to see how to kill a threat or Terminator threat.
This is a copy of a threat resume project.
So I'm simply going to replace the department that does the.
The part that does the suspension and the resumption, I'm going to just delete that, okay, and then
I'm going to delete this part and that's the resumption as well.
OK.
And then up here, let's see, OK, up here, the global variables we had, I'm going to remove them.
We're going to bring a new set of global variables, OK?
We're going to have execution monitor and then a resume monitor and then if like so we're going to see
red execution monitor, resume monitor.
And then this boolean will tell us what the threat is killed or not.
So this time the execution monitor is like our suspend monitor.
We're going to increment the execution monitor until it hits a particular threshold and then we can
decide to terminate the threat.
So we're going to use blue threat to terminate the red threat.
OK, so I'm going to come over here inside the blue thread.
And I'm going to first start off by incrementing our red execution monitor and then we're going to see
if the execution monitor, let's see, is equal to forty nine, then we want to set our flag cued to
true.
And then we want to reset the execution monitor by setting it back to zero and calling this new API
here called us threat terminate.
This terminates the threat.
It takes one argument and that is the idea of the threat that you wish to terminate.
And what we want to do is we're going to have a controlled experiment to show that this is not the same
US suspend.
We would try to resume this terminated threat and see what happens.
So inside our orange alert controller to ask what I'm going to do is I'm going to check if our cute
flag is set and if it's set, I'm going to try to resume.
It's so over here, we would say if killed sets, we would set our resume.
Plus plus, this is our resume counter that we had before.
And we're going to see if the monitor is, say, equal to 100, then we want to see always threat resume
and then we set the spark to zero and then said this box secured just like we had before, before we
had this on top.
So for me to show you, it's exactly the same.
We said these before actually doing the rounds, before actually doing the resumption.
So this what we had before, but it was suspension, resumption now is termination resumption.
Let's see how that goes.
Going to right click over here to build the project.
It's built successfully, and I'm going to right click over here and I'll say debug system 32.
I select this thirty nine.
And then I say, OK, over here.
And I'll click switch over here.
OK, and then.
I would suspend monitor doesn't exist anymore, I'm just going to take the suspend and resume monitors
out less quick to run and see what we have.
OK, let's see, Red Task is suspended.
It's not coming back, it's a Terminator, sorry, so it's not coming back, although we are trying
to resume it and when we issue other resume Wanita to the watch window, you realize that resume monitor
always crosses its threshold, but nothing happens.
There's the resume monitor, its Richard 100 goes back to zero by Red Task is just terminated.
So that's the difference between resumption.
That's the difference between suspension and termination.
OK, that's all there is.
I'll see you later.
Have a nice day.