I am guessing that you are running this TCL script from within one of the UPoCs in the engine. We had to do something similar, but it was only stopping a thread and not the whole process. What we have come up with (right or wrong), which seems to work OK is this. We call a TCL proc from within the UPoC, called stop_thread:
proc stop_thread { thread { delay 5 } } {
global HciSiteDir ;# Site Directory
echo “HCISITEDIR=>$HciSiteDir<"
set pname [get_pname $thread]
echo "Process=>$pname<"
system "$HciSiteDir/tclprocs/delay_hcicmd $delay $pname $thread pstop &"
}
proc get_pname { thread } {
set conndata [exec hciconndump $thread]
set lines [split $conndata n]
set thdinfo [lindex $lines 3]
set pname [lindex $thdinfo 0]
if {"$pname" == ""} {error "Thread not found: $thread"}
return $pname
}
As you see this proc calls a KSH script (shown below) in the background, which sleeps for a period of time, and then runs hcicmd to stop the thread, to prevent other messages from processing during the delay. I believe the reason was that you cannot stop a thread or process cleanly while working on a particular message, and needed to run it outside the UPoC. There are other things the calling UPoC does to prevent other messages from processing until the thread stops.
# cat delay_hcicmd
#!/bin/ksh
sleep $1
hcicmd -p $2 -c “$3 $4 $5 $6 $7 $8 $9”
So depending on where you are with your call, you can do something similar, of course modify the hcicmd call to either hcienginestop or hcicmd -p $proc -c ‘. die’ to kill the process, however, you will probably need to address the fact that other messages will attempt to process until the actual process stop executes.
Hope this helps,
Robert Milfajt
Northwestern Medicine
Chicago, IL