Purpose
This function is used to create a new thread in the current process. The newly created thread will assume the attributes defined in the thread attribute object attr, if it is provided. Otherwise, the new thread will have system default attributes. The new thread will begin execution at the subroutine ent, which is required to have one dummy argument. The system will pass the argument arg to the thread entry subroutine ent as its actual argument. The argument flag is used to inform the system of the property of the argument arg. When the execution returns from the entry subroutine ent, the new thread will terminate automatically.
If subroutine ent was declared such that an explicit interface would be required if it was called directly, then an explicit interface is also required when it is passed as an argument to this function.
The argument arg is a generic argument that can be of any type and any rank. The actual argument arg must be a variable, and consequently eligible as a left- value in an assignment statement. If you pass an array section with vector subscripts to the argument arg, the result is unpredictable.
If the actual argument arg is an array section, the corresponding dummy argument in subroutine ent must be an assumed-shape array. Otherwise, the result is unpredictable.
If the actual argument arg has the pointer attribute that points to an array or array section, the corresponding dummy argument in subroutine ent must have a pointer attribute or be an assumed-shape array. Otherwise, the result is unpredictable.
Class
Function
Argument Type and Attributes
On successful completion of the function, f_pthread_create stores the ID of the created thread in the thread.
The argument flag must convey the property of the argument arg exactly to the system. The argument flag can be one of, or a combination of, the following constants:
Result Type and Attributes
INTEGER(4)
Result Value
On successful completion, this function returns 0. Otherwise, this function returns one of the following errors.