General thread considerations
To see the advantages and disadvantages of the two types of thread-safety
for RPG, see the section on multithreaded applications in Rational Development Studio for i: ILE RPG Programmer's Guide. For a list of system functions that are not allowed or supported in
a multithreaded environment, see the Multithreaded Applications document under
the Programming topic at the following URL:
http://www.ibm.com/systems/i/infocenter/
You cannot use the following in a thread-safe program:
- *INUx indicators
- External indicators (*INU1 - *INU8)
- The LR indicator for the CALL or CALLB operation
When using the THREAD keyword, remember the following:
- It is up to the programmer to ensure that storage that is shared
across modules or threads is used in a thread-safe manner. This includes:
- Storage explicitly shared by being exported and imported.
- Storage shared because a procedure saves the address of a parameter or a pointer parameter, or allocated storage, and uses it on a subsequent call.
- Storage shared because STATIC(*ALLTHREAD) was specified on the definition of the variable.
- If shared files are used by more than one language (RPG and C, or RPG and COBOL), ensure that only one language is accessing the file at one time.