So let's consider the following function which loops through a complex code every 5 seconds.
We want this function to monitor something so let's make a thread out of it.
And my dilemma starts here:If for example I want the thread to simply cease to exist what is the best solution for it ? There are some functions regarding the killing of threads but I cannot find the difference between them,for example:
Does executing the following commands simply kills of the function without going through the block of code and without waiting for that 5 second delay or just simply breaks the while statement after the block of code + the 5 second delay executes?
Code:
function something_random ()
while ( true ) do
code block
delay(5)
end
end
We want this function to monitor something so let's make a thread out of it.
Code:
something_random_handle = INVALID_THREAD_HANDLE
something_random_handle = thread_new("something_random")
And my dilemma starts here:If for example I want the thread to simply cease to exist what is the best solution for it ? There are some functions regarding the killing of threads but I cannot find the difference between them,for example:
Code:
thread_kill(something_random_handle)
cleanup_threads(something_random_handle)
Does executing the following commands simply kills of the function without going through the block of code and without waiting for that 5 second delay or just simply breaks the while statement after the block of code + the 5 second delay executes?