What I want to do:
Send a command to a GPIB instrument to trigger a time-consuming task, then I should be able to stop the time-consuming task anytime before it finishes normally.
What I have done:
Call these functions in one thread,
ibtmo(ud, 16) #set timeout to 300s
ibwrta(ud, "...", ...) #write the command asynchronously
ibwait(ud, TIMO | RQS) #wait for RQS or timeout
When I try to cancel the time-consuming task, I call these functions in another thread,
ibstop(ud)
ibwrt(ud, "...", ...) #write instrument specific cancel command
I've also tried to use ibonl,
ibonl(ud, 1) #reset the interface
ibwrt(ud, "...", ...) #write instrument specific cancel command
Problem:
both ibstop and ibonl take too long to return, they seems to wait the time-consuming task to finish and then return, which isn't what I want to do. Did I do the right thing? Where is the problem? Any help is greatly appreciated.
PS:
I wrote the program in C
GPIB driver version is 2.4