I am not saying they cannot. I am just saying you are crazy to do it. RPG
is not a language ever built to do multi-threading. Your problem is really
this. It is not just one RPG program you have to worry about. How many
people have a clean stack? In other words, no legacy code anywhere in the
stack?. Every single program in the stack has to be coded for
multi-threading. Introduce one program in the stack that is not thread-safe
and you have a disaster and every programmer who is working on a program on
that stack has to know and understand multi-threading. That is not simple.
Even in languages that support it, multi-threading is a difficult problem.
It is not just something you slap in.

On Wed, Oct 27, 2021 at 9:23 AM Hiebert, Chris <chris.hiebert@xxxxxxxxxxxxxx>
wrote:

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.




--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.