|
Steve: It is possible to do threading in RPG, I have done it (however it is easier to do in C). There are a few "gotchas". 1) Never set on LR in a thread. This will take down the entire job. 2) Service programs are shared amongst threads and only one thread can access a function at a time. 3) File pointers are shared amongst threads. I found this PDF to be helpful (it is 2mg): http://www.damontech.com/OS400PthreadAPIs.pdf I hope this helps, Schadd Gray Damon Technologies, Inc. www.damontech.com ----- Original Message ----- From: "Hans Boldt" <boldt@xxxxxxxxxx> To: <rpg400-l@xxxxxxxxxxxx> Sent: Wednesday, May 21, 2003 7:09 AM Subject: Re: threading in rpg. was RPG and Web.. (was Using OO conceptsinRPG) > Steve Richter wrote: > > As of V5R2, with IO direct into a data struct, procs dont have to use any > > global variables. And if files are opened and accessed using some sort of a > > handle, then file I/O could be thread safe. > > > > Interestingly, a lot of the changes that would make an rpg proc threadsafe, > > like no global mapping of fields thru a data struct, file opens that are > > local to a proc and passed with a handle from proc to proc, would make the > > code more modular and less error prone. > > Steve: I think you're still missing something here. If the only > issue were user defined variables, there would be no problem with > threading. At least there wouldn't be a problem for the compiler - > all the synchronization issues would fall squarely on the back of > the RPG programmer. No, the problem is with the compiler-generated > internal data structures. Things like file control blocks and > feedback areas, and also data structures involved with the RPG > exception model. > > If you really think you have to do a threaded application, and you > want part of it RPG, go right ahead. The way to do it now would be > to write some of your code in C, which calls RPG procedures in > modules compiled with THREAD(*SERIALIZE). If you can understand all > the issues involved with threading, you can certainly handle a bit > of C programming. ;-) > > Cheers! Hans > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.