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