Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function Timeout
#1
What is the simplest way to end a function if it runs for longer than a specified time?




I have some files I'm grabbing from FTP and sometimes the function hangs up and never grabs the files and never throws an error.

So after like 30 seconds...kill the thread!

Thanks
_jim
#2
Function example_ftp
Code:
Copy      Help
;/exe
mes "ftp"

;BEGIN PROJECT
;main_function  example_ftp
;exe_file  $my qm$\example_ftp.qmm
;flags  6
;guid  {CEDB34A2-079B-44F0-8A3E-BC2A04D66DD7}
;END PROJECT

Macro Macro299
Code:
Copy      Help
int ht=mac("example_ftp")
wait 5 H ht
err EndThread "" ht


Or everything in single exe:
Function example_ftp2
Code:
Copy      Help
;/exe

int ht=mac("sub.Thread")
wait 5 H ht; err


#sub Thread
mes "ftp"

;BEGIN PROJECT
;main_function  example_ftp2
;exe_file  $my qm$\example_ftp2.qmm
;flags  6
;guid  {A566CFC8-6A72-454E-941F-1CB189873293}
;END PROJECT


Forum Jump:


Users browsing this thread: 1 Guest(s)