Hello, welcome back.
And this lesson, we're going to see how to suspend a threat, I'm going to make a copy of our last
project over here.
I'll copy this and paste over here, and I'll simply call this thread suspend.
Like this.
Copy over here.
And this is similar to the threat suspend we had used in our native free ARTUS APIs, so I would advise
you post the video and try to implement the same thing using the census artist to APIs.
And you can go to our documentation here to find the appropriate API to use for this.
Of course, you can simply fine over here.
There's always threat to suspend API rights.
So post the video and try to just support our old OS threat to suspend.
Remember, we have one who has threats to spend somewhere.
Where is it?
Number four or something.
Let's see, we suspended the threat, OK, number eight, suspend the threat, we're going to implement
the same thing using Simms's artists.
OK, so I'm sure you've tried on your own.
So the projects we made a copy of changes the change, the priority of one of the threads.
So I'm going to delete that piece of code.
This is where we we let's see, where is it?
Which one is this we are here threaten to suspend.
OK, so I think I ended up making a copy of a threat creates function.
OK, so I'm going to actually quickly make a copy of our threat priority, our threat, threat, priority
quote, The reason why that is, is because we would have to type again and add the threat IDs.
OK, so this is a copy of our always our top priority project.
So in this project, we.
We thought the threat I'd returned from the new threat in their respective variables and over here.
The orange bellied controller threat changed the priority of the green threat.
We don't need that.
So I'm going to delete this, OK, so what I'm going to do is just like we did in our previous project,
I'm going to define a number of global variables.
I'll use a counter.
And when the counter counts to a particular amount, we're going to suspend one of the threats.
So we use the counter code, suspend monitor.
We're going to just use the same thing here.
So I'm going to define, suspend monitor over here.
And what I'm going to say is, OK, suspension, it's a plus plus over here.
So whenever there's an iteration, suspend monitor the screen to.
It's going to increment and we can see if suspend monitor.
Is greater than or equal to forty nine, then we want to suspend blue thread this delay that we use
here.
This from I equals zero I less than seven hundred thousand.
I'm going to simply change this to I less than seven thousand for each thread.
So that we can increment more quickly, so we have seven thousand No.
OK, so we're going to suspend using the EU's threat suspend function, let's wait and see what we've
got.
Click over here to build.
It's built successfully, right click.
I'll see debuggers.
Where are we?
Debuggers, OK?
And then OK, over here.
A click to switch.
And I'm going to click here to run.
Yeah, all incrementing.
And as you can see, they've all stopped.
Let's see what's happening here.
It seems we are running the old cold because we have this green run in here.
OK.
The old court run in Cuba makes likes doing this, you see, we are running the thread priority code,
OK, I'm going to close this and I'm going to do it again.
Where is this we have to suspend?
We're going to close this and then open our Simms's thread to suspend open demand or C followed by here.
And.
Let's see.
OK, so this is our quote that we added, OK, we're going to click here, right click we're going to
be able to project.
It's about we're going to right click, we're going to say debuggers SDM 32, we're going to select
thirty seven, our latest project.
Then we're going to say, OK.
Then switch.
It's Lodin.
It's already so click here to run.
You can see we have them incrementing faster, but bluegill suspended when we hit 50, just like we
said.
So this is very simple, very straightforward.
We've seen this before using the native apes as The Simpsons Arktos to version.
And the next lesson, of course, we'll see how to resume a suspended thread.
But I would I would ask you to try it out on your own before you open the next lesson.
So I'll see you in the next lesson.