Executes previously loaded code as a thread.
Item ExecuteAsThread(CodeHandle code,int32 argc, char **argv,char *threadName, int32 priority);
This function lets you execute a chunk of code that was previously loaded from disk using LoadCode()
. The code will execute as a thread of the current task.
In order to function correctly, code being run as a thread should be linked with threadstartup.o instead of the usual cstartup.o.
The argc and argv parameters are passed directly to the main()
entry point of the loaded code.
The values you supply for argc and argv are irrelevant to this function. They are simply passed through to the loaded code. Therefore, their meaning must be agreed upon by the caller of this function and by the loaded code.
threadName specifies the name of the thread.
priority specifies the priority the new thread should have. Providing a negative priority makes the thread inherit the priority of the current task or thread.
Returns the item number of the new thread, or a negative error code if the thread could not be created.
Folio call implemented in file folio V21.
filefunctions.h
LoadCode
(), UnloadCode(), ExecuteAsSubroutine()