Re: Using :requires to load some common routines
Swifty wrote:
> On Sat, 03 Mar 2012 19:22:10 -0500, Rick McGuire
> <object.rexx@gmail.com> wrote:
>
>> This question makes no sense to me.
>
> I wrote an init.rex that requires init.sub
>
> Init.sub contains:
>
> Trace ?r
> Say 'In init.sub'
> If .local~init.var = .Nil then .local~init.var = time()
>
> Init.rex contains:
>
> Trace ?r
> Say 'In init.rex'
> Say .init.var
> 'start init.rex'
> Say 'init.rex about to exit'
>
>
> When I run init.rex, I see the code in init.sub running. When the
> first instance of init.rex starts a second instance of init.rex, I see
> the code in init.sub executing again.
>
> So, presumably both instances loaded their own distinct instance of
> "init.sub".
>
> I think we should be careful to distinguish between the first load of
> init.sub within the current rexx process and the more global "first
> load of init.sub" (I don't think this concept has any significance,
> practically speaking).
>
Doesn't START start a new thread? If you want to replicate what the discussion
was about, wouldn't you have to do something like:
main.rex
call inita
call initb
exit
inita.rex
-- some code
::requires initsub.rex
initb.rex
-- some code
::requires initsub.rex
initsub.rex
--initialization code
::routine demo1 public
Then wouldn't you expect the initialization code to run only once?
--
Les (Change Arabic to Roman to email me)
|