Yes, I agree that you can use *Serialize but that means that all the other
threads are shut down until processing is completed for that thread. I have
processing that needs to be done. I have no idea what processing or how
much time that processing will take at the time I write the socket server.
That processing might take 10 seconds, it might run for 10 minutes or an
hour. Completely unknown which is why I want to run that processing in a
pre-start job.

Now looking back at the project, it is a whole lot simpler to write it in
RPG and just do a spawn of another RPG job. That RPG job handles the
network communications to the client and runs the processing. Pretty
simple. I did it in C but that was fairly complex. It took me weeks of work
(My own time) to figure it out but in the end it worked. Then I went back
and wrote in RPG. A lot simpler but in both cases I still had the same
problem. In order to publish the project, I felt I would need to
encrypt the communications and that just seemed like a huge problem so I
gave up on it.

On Wed, Oct 27, 2021 at 11:36 AM Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>

IMHO, it's significantly easier to code thread safe RPG programs vs. C
programs. RPG has built-in support for ensuring static variables are
separated for each thread, for serializing multi-threaded access, etc.
In C, you have to code those things yourself using mutexes, semaphores,
et al.

So, I agree with Chris.. you're definitely not "crazy to do it".
Though, in general, I would avoid multi-threaded programming in any
language unless there's a really good reason to use it. But, writing a
TCP network server is one environment where it often makes sense.


On 10/27/2021 12:19 PM, Hiebert, Chris wrote:
I am not saying they cannot.
But you did. You said "because RPG programs are not thread-safe"
Don't report that the language is not thread-safe, when it is.

C programs are not always thread-safe either. But people still code
multi-threaded c programs.

I am just saying you are crazy to do it.
Exactly. So you choose not to use it. Because it's too hard for you to
learn or train or get adopted.
Whatever the reason is that's fine, it's still your choice.

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,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related

Help support by shopping at with our affiliate

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 by 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.