stopThread()

Stops a thread.

Synopsis

int stopThread(int threadId,bool log = true);

Parameters

Parameter Description
threadId ID number of the thread to be stopped.
log If this parameter is set to false, no warning will be written in the log if the thread with threadId does not exist or there is any other reason the thread cannot be stopped or waited for.

Return value

0, in the event of errors -1.

Errors

Missing/incorrect argument, for example, the specified thread does not exist.

Description

Stops the thread with the identification number threadId.

A thread can only be stopped in the instance it was started in.

It is not possible to stop the current thread: stopThread(getThreadId()).

Example

main()
{
  stopThread(40);
}

Assignment

Threads

Availability

CTRL