Creates a thread.
Item CreateThread( const char *name, uint8 pri, void (*code) (),int32 stacksize )
This procedure creates a thread. The resulting thread belongs to the calling task.
The procedure returns the item number of the thread or an error code if an error occurs.
Convenience call implemented in clib.lib V20.
There is no default size for a thread's stack. To avoid stack overflow errors, the stack must be large enough to handle any possible uses. One way to find the proper stack size for a thread is to start with a very large stack, reduce its size until a stack overflow occurs, and then double its size.
When you no longer need a thread, use DeleteThread()
to delete it. Alternatively, the thread can return or call exit()
.
You can use FindTask()
to find a thread by name. When naming threads, you should assign unique names whenever possible.
DeleteThread
(), exit()