Hi quiesce,
Ah, the wonders of multithreading :-)
Creating multithreaded code has its complications. But generally what you do is to define a function that serves as the entry point for the new thread.
The next thing is to create a thread and tell it to launch from that address. You have two choices under amiagos
1) Use an exec.library Task
Tasks are lightweight and do not use many resources. Their principal drawback is that they cannot use dos.library or anything else which may use it (eg normal C IO mechanisms).
Use tasks when character IO is not important for your code.
You need to look at exec.library/AddTask() or amiga.lib/CreateTask()
Eg :
struct Task* myTask;
void myTaskMain()
{
/* code for myTask */
}
/* struct Task* CreateTask(name, pri, entry, stacksize)*/
myTask = CreateTask("mytask", 0, myTaskMain, 4096);
2) Use a dos.library Process
This is an exec.library task extended with the various handles that allow it to use the dos.library. It's pretty much complete. You need to look at dos.library/CreateNewProc(). This call returns a struct Process* (castable to struct Task*) and takes a range of arguments as a taglist.
If you do go for multithreading, you need to protect data that is used from parallel threads. You have to ensure that modifications to data are exclusive. For this you need to look at Signal Semaphores (see exec.library manuals).
You will also need to look at signalling and sending messages such that your threads can norify each other. An understanding of how exec works is very handy here.
It sounds a bit more complex than it is but it's also not for the beginner either.