Synchronization of the prolog code is performed using the GUARDED mechanism
on the package object. When you are calling it directly using
CallProgram(), this works because the same Rexx thread already has the
lock, so this does not block the execution. When you create the new
instance, the caller is not recognized as coming from the same Rexx thread
because it is running under the new instance. They are running on the same
OS thread, but because the new instance was created, they are not part of
the same activity, so the GUARD lock blocks until the lock is released.

Rick


On Wed, Jul 26, 2017 at 2:38 PM, Gil Barmwater <gbarmwa...@alum.rpi.edu>
wrote:

> Yep, that explains it - the prolog code is where the native routine is
> called so it has not finished when the second interpreter tries to load it
> again.  It is interesting that if I just use the current interpreter to
> call the program - context->CallProgram(...) - from the native routine, the
> lock does not occur.  Of course the current interpreter doesn't have the
> options I want.   Hummm...
> Gil
>
> On 7/26/2017 2:29 PM, Rick McGuire wrote:
>
>
> On Wed, Jul 26, 2017 at 1:49 PM Gil Barmwater <gbarmwa...@alum.rpi.edu>
> wrote:
>
>> OK, that is what I expected.
>>
>> I have now determined why my earlier attempts failed and it was not due
>> to the bad return code.  I'm attempting to run the same program recursively
>> under the second/new interpreter but it hangs until I double control-c.
>> The program has a Requires directive which is where the native Routine is
>> called.  I have made copies of the program file and the requires file and
>> modified the copied program to specify the copied requires file.  With
>> these changes (and having the native routine run the copied program under
>> the new interpreter), everything works as I had expected.  So, I'm guessing
>> there is a file lock involved somewhere, probably on the Requires file.  Is
>> this intentional?  I'm pretty sure I've written recursive program before
>> but perhaps not :-(.
>>
> it the call is occurring from the prolog portion of the ::requires file
> that's probably what's happening. ::requires are loaded only once so the
> package manager detects that the file has already been loaded but the
> prolog portion has not finished running yet so it waits for it to complete.
>
>>
>> Gil
>>
>> On 7/26/2017 10:42 AM, Rick McGuire wrote:
>>
>> .environment is shared with other instances, but each instance has its
>> own version of .local.
>>
>> Rick
>>
>> On Wed, Jul 26, 2017 at 10:39 AM, Gil Barmwater <gbarmwa...@alum.rpi.edu>
>> wrote:
>>
>>> Oh, and one other question - does the new interpreter share the global
>>> environment or is it totally independent?
>>> Gil
>>>
>>> On 7/26/2017 10:35 AM, Gil Barmwater wrote:
>>>
>>> You are right!  The interpreter WAS actually created and I was able to
>>> get it to run a simple Rexx script.  Thanks!  And I guess I should get a
>>> new 5.0.0 build; I'm on 2 May 2017.
>>> Gil
>>> On 7/26/2017 9:53 AM, Rick McGuire wrote:
>>>
>>>
>>>
>>> On Wed, Jul 26, 2017 at 9:44 AM, Gil Barmwater <gbarmwa...@alum.rpi.edu>
>>> wrote:
>>>
>>>> I've been experimenting with the ooRexx Native API and have run across
>>>> a problem.  I have created a native routine which runs successfully.  I now
>>>> want to have that native routine create another interpreter instance with
>>>> options.  However, the RexxCreateInterpreter() function returns 1002, not 1
>>>> or 0 as the Programmer's Guide says.  I'm guessing that I cannot do what
>>>> I'm attempting but I'd like to understand why not.  Thanks!
>>>
>>>
>>> Where was a bug that has already been fixed in the most recent 5.0.0
>>> builds that was causing it to return a bad return code. I think you'll find
>>> that the create actually did work.
>>>
>>> Rick
>>>
>>>
>>>
>>>>
>>>>
>>>> --
>>>> Gil Barmwater
>>>>
>>>>
>>>> ------------------------------------------------------------
>>>> ------------------
>>>> Check out the vibrant tech community on one of the world's most
>>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>> _______________________________________________
>>>> Oorexx-devel mailing list
>>>> Oorexx-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Oorexx-devel mailing 
>>> listOorexx-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>
>>> --
>>> Gil Barmwater
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Oorexx-devel mailing 
>>> listOorexx-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>
>>>
>>> --
>>> Gil Barmwater
>>>
>>>
>>> ------------------------------------------------------------
>>> ------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>> _______________________________________________
>>> Oorexx-devel mailing list
>>> Oorexx-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Oorexx-devel mailing 
>> listOorexx-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>
>> --
>> Gil Barmwater
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot______
>> _________________________________________
>> Oorexx-devel mailing list
>> Oorexx-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Oorexx-devel mailing 
> listOorexx-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
> --
> Gil Barmwater
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-devel mailing list
> Oorexx-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to