because RPG programs are not thread-safe
Not true.
RPG programs can be coded thread-safe.
Most just "choose" not to use the methods required to make the program thread-safe.
Some are just too attached to global file specs and global variable definitions.
Others just don't want to learn a new way to use RPG.
I'm not saying every RPG program should be multithreaded.
I'm just saying that the tool exists in the toolbox if you choose to use it.
Multithreaded RPG became much more usable once Procedures were allowed to locally define the File Spec.
From what I've found using threads is very easy in RPG.
IBM has even provided some examples of how to accomplish multithreading ILE RPG.
https://www.ibm.com/docs/en/i/7.3?topic=procedures-multithreading-considerations
https://www.ibm.com/docs/en/i/7.3?topic=apis-how-build-examples
https://www.ibm.com/docs/en/i/7.3?topic=serialize-general-thread-considerations
Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Alan Campin
Sent: Wednesday, October 27, 2021 8:06 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Prestart Jobs for speeding up TCP/IP servers
One thing that I should note here. I am a really crappy C programmer. I
would imagine that any C programmer that looked at my code would laugh him
or herself to death but I make it work. Just not very good at it.
One other note. In C, I use multi-threading and pre-start jobs because RPG
programs are not thread-safe. The threads handle the conversation with the
socket client and the pre-start jobs are just RPG programs that do the RPG
work.
In RPG, you switch to a pre-start job to handle the conversation with the
socket client and run the RPG work.
As an Amazon Associate we earn from qualifying purchases.