Re: [Oorexx-devel] Questions ad Halt() and Terminate(), as well as RexxSetHalt()
Terminate() does not terminate threads, it terminates the interpreter instance. The termination call can only be made on the original thread that created the interpreter instance and will wait for any other threads to terminate before shutting down the instance. Halt() can be issued from any thread, and does not even require an AttachThread() call since it is a method of the instance context. There's no way to determine if there are any threads active on the instance, and I really doubt it is safely possible. The legacy APIs can be used, but I really don't recommend their usage. They really just map down into the appropriate Halt() calls. Rick On Mon, May 25, 2009 at 5:26 AM, Rony G. Flatscher rony.flatsc...@wu-wien.ac.at wrote: In the new APIs one is able to use the Rexx interpreter instance to issue a Halt() and/or Terminate(), which will halt/terminate all Rexx threads of that particular Rexx interpreter instance. Question: is it possible that problems arise, if Halt() and Terminate() are not issued from the thread that created the Rexx interpreter instance? Is it possible to learn whether any Rexx threads are still active, despite calls to Halt()? What happens, if Terminate() returned and one still uses that Rexx interpreter instance afterwards? Is this safely possible? --- Can RexxSetHalt(pid, tid) and RexxSetHalt(pid, 0) still be safely used? ---rony -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel
Re: [Oorexx-devel] Questions ad Halt() and Terminate(), as well as RexxSetHalt()
Rick McGuire wrote: Terminate() does not terminate threads, it terminates the interpreter instance. The termination call can only be made on the original thread that created the interpreter instance and will wait for any other threads to terminate before shutting down the instance. O.K.: studying a use case from a BSF4Rexx user who uses Java multithreading to dispatch Rexx scripts: from debug output I can see that the Terminate() is called on another thread than the one that carried out the RexxCreateInterpreter(). Terminate() seems to return immediately. This is done twice in that Java program. The first thread with running a Rexx program is halted with RexxSetHalt(pid, 0) followed by a Terminate(), whereas the second thread is halted with Halt(), followed by a Terminate(). Then, when all Rexx programs started on different Java threads ended (judged by the output they produce with SAY), the Java side still seems to wait on Rexx to finish (after the last thread's Rexx program ran). Questions: * Shall I prevent calls to Terminate() if issued on the wrong thread? * Should the Rexx interpreter instance indicate success or failure of Terminate(), currently it is defined to return void ? * Could it be that given the above scenario, that the Rexx runtime gets into a state where it waits? If so, how could one prevent that to happen or, alternatively, how to forcefully end a Rexx instance? Halt() can be issued from any thread, and does not even require an AttachThread() call since it is a method of the instance context. There's no way to determine if there are any threads active on the instance, and I really doubt it is safely possible. The legacy APIs can be used, but I really don't recommend their usage. They really just map down into the appropriate Halt() calls. How could RexxSetHalt(pid, 0) (halt all running Rexx threads, assuming that all means of all interpreter instances) be expressed with the new APIs? ---rony -- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, Big Spaceship. http://www.creativitycat.com ___ Oorexx-devel mailing list Oorexx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/oorexx-devel