[archive] creating different instances of the same program

[Migrated content. Thread originally posted on 14 February 2008]


in many circumstances i need to have more than one instance of the same program in a runtime unit.
I know you can deal with this issue using some multi-thread technique, but the mechanism of "send/receive" is too slow compared to the "call using".

So I suggest something like:

77 hnw-my-subprogram-1 handle of program.
77 hnw-my-subprogram-2 handle of program.


call "c$factory" using "myprog" giving hnw-my-subprogram-1.
call "c$factory" using "myprog" giving hnw-my-subprogram-2.

obtaining two different instances of "myprog", and calling each one by their respective handles

call hnw-my-subprogram-1 using par1, par2, par3
call hnw-my-subprogram-2 using par1, par2, par3

now assume that "myprog" exposes different entry points:

program-id. myprog.
procedure div.
entry "entry_1" using...
entry "entry_2" using...

you call the entry point of a program handle using something like:

call entry_1 (of | in) hnw-my-subprogram-1 using par1, par2, par3, or
call hnw-my-subprogram-1::entry-1 using par1, par2, par3

any comment is greatly appreciated, thanks !