| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Looking at thread termination issues, I started to wonder if RexxSetHalt could be invoked from the spawning Rexx program and force the halt condition in its thread. Has anybody done this and are there any possible samples around? |
|
#2
| |||
| |||
| I figured out the solution and it actually works very well. Note I only tested it under ooRexx but I'm convinced Regina would work just as well. The key is using GCI. Here is the procedure: 1. add the code to "signal on halt" in the thread 2. Obtain via RxQueue the PID and TID from the thread. Likely right after the reply statement as this is when the thread acquires its new TID: pid = SysQueryProcess('PID') tid = SysQueryProcess('TID') 2. Use these definitions to invoke "RexxSetHalt" function definition: RexxSetHaltDef.calltype = "stdcall as function" /* can't use "with parameters" because of complex arguments */ RexxSetHaltDef.return.type = "integer32" RexxSetHaltDef.0 = 2 RexxSetHaltDef.1.type = 'unsigned32'; RexxStartDef.1.name = 'ProcessId (PID) - input' RexxSetHaltDef.2.type = 'unsigned32'; RexxStartDef.1.name = 'ThreadId (TID) - input' call RxFuncDefine "RexxSetHalt", "rexx.dll","RexxSetHalt", "RexxSetHaltDef." execution: RexxSetHaltDef.1.value = threadPid RexxSetHaltDef.2.value = threadTid call RexxSetHalt "RexxSetHaltDef." ret = RESULT This forces the HALT condition. As simple as that. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.