[Oorexx-devel] Question ad unloader function

2009-06-07 Thread Rony G. Flatscher
Currently, I have been trying to debug the following problem: unloader
function does not run.

Scenario #1: there is the BSF4Rexx.dll which contains a loader and an
unloader function. If rexx.exe starts a Rexx program that then loads the
BSF4Rexx.dll, the loader runs and when the Rexx program ends, the
unloader runs.

Scenario #2: there is the BSF4Rexx.dll which contains a loader and an
unloader function. Java loads the BSF4Rexx.dll, not rexx.exe. Then Java
creates a Rexx interpreter instance, which starts a Rexx program that
then loads the BSF4Rexx.dll, the loader runs, *but* when the Rexx
program ends, the unloader does not run! Looking at the different code
paths to scenario #1, then the following can be observed:

* a Rexx instnace is created using the following option (the package
  definition defines the loader and unloader function), the loader
  function executes:

  RexxLibraryPackage pkg;
  pkg.registeredName   = BSF4Rexx;
  pkg.table= bsf_package_entry;

  options[0].optionName= REGISTER_LIBRARY;
  options[0].option= (void *) pkg; //
  bsf_external_functions;  //
  options[1].optionName=NULL;

  No AttachThread() nor DetachTrhead() are invoked.

* a Rexx script is sent from Java via JNI and the above Rexx
  interpreter instance is used to execute it using NewRoutine()
  and then CallRoutine(); here an AttachThread() and a matching
  DetachThread() is carried out.

* Before the Java program ends, it will use JNI to Terminate() the
  Rexx interpreter instance that got created and employed above. No
  AttachThread() nor DetachTrhead() are invoked.

Going over the code-path of scenario #2 to the best of my knowledge, no
Rexx thread exists that would be executing, hence I would expect that
the unloader function would run.

Any ideas or hints what might be the cause in scenario #2 that the
unloader function does not run?

---rony

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel


Re: [Oorexx-devel] Question ad unloader function

2009-06-07 Thread Rony G. Flatscher
Rick McGuire wrote:
 The Terminate() call must be made on the same thread that called
 RexxCreateInterpreter originallythat's the only issue I can think
 of that might prevent things from shutting down.
   
Just double-checked, Terminate() is issued on the same thread as
RexxCreateInterpreter().

---rony


 On Sun, Jun 7, 2009 at 10:06 AM, Rony G. Flatscher
 rony.flatsc...@wu-wien.ac.at wrote:
   
 Currently, I have been trying to debug the following problem: unloader
 function does not run.

 Scenario #1: there is the BSF4Rexx.dll which contains a loader and an
 unloader function. If rexx.exe starts a Rexx program that then loads the
 BSF4Rexx.dll, the loader runs and when the Rexx program ends, the unloader
 runs.

 Scenario #2: there is the BSF4Rexx.dll which contains a loader and an
 unloader function. Java loads the BSF4Rexx.dll, not rexx.exe. Then Java
 creates a Rexx interpreter instance, which starts a Rexx program that then
 loads the BSF4Rexx.dll, the loader runs, *but* when the Rexx program ends,
 the unloader does not run! Looking at the different code paths to scenario
 #1, then the following can be observed:

 a Rexx instnace is created using the following option (the package
 definition defines the loader and unloader function), the loader function
 executes:

 RexxLibraryPackage pkg;
 pkg.registeredName   = BSF4Rexx;
 pkg.table= bsf_package_entry;

 options[0].optionName= REGISTER_LIBRARY;
 options[0].option= (void *) pkg; // bsf_external_functions;  //
 options[1].optionName=NULL;

 No AttachThread() nor DetachTrhead() are invoked.

 a Rexx script is sent from Java via JNI and the above Rexx interpreter
 instance is used to execute it using NewRoutine() and then
 CallRoutine(); here an AttachThread() and a matching DetachThread() is
 carried out.

 Before the Java program ends, it will use JNI to Terminate() the Rexx
 interpreter instance that got created and employed above. No AttachThread()
 nor DetachTrhead() are invoked.

 Going over the code-path of scenario #2 to the best of my knowledge, no Rexx
 thread exists that would be executing, hence I would expect that the
 unloader function would run.

 Any ideas or hints what might be the cause in scenario #2 that the unloader
 function does not run?

 ---rony

 


--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel