Jump to content

how to prevent computer got hang.


Recommended Posts

Hi,

I am working on a project which require to use an activeX module to communicate with another system. When I intialize the communication, sometime it got hang, sometime it's not. I try to use the delay module, but it didn't help. I would like to know how to implement a timeout module or watchdog so I can jumpout of the subVI.

I intend to use this module (picture is attached) inside the subVI dealling with initialize the activeX module, but it stop the whole program. Do you have any suggestion?

Thank you,

Thang

Link to comment

Try using a sequence structure with 2 frames. Initialize in the first frame, and then put a Wait (ms) function in the 2nd frame to have the code wait for a certain amount of time after initializing.

ActiveX and dll calls are sometimes very difficult to work with because they'll freeze up your entire program if the ActiveX or dll themselves are buggy (because they run in the User Interface thread).

Bruce

Link to comment

@tcplomp: I am testing using your method. I also try with the property node return the state of the execute VI.

QUOTE (bmoyer @ Jun 25 2008, 02:41 PM)

Try using a sequence structure with 2 frames. Initialize in the first frame, and then put a Wait (ms) function in the 2nd frame to have the code wait for a certain amount of time after initializing.

Bruce

@Bruce: the PC will hang at the first frame. The 2nd frame has no chance to start.

I am still testing it. Let you know when I got sth happy.gif

Link to comment

Thang:

I use quite a bit of ActiveX. I am curious as to what you are doing inside the initialize ActiveX subVI. E.g: Do you start a new instance of ActiveX ref as you initialize in the loop? Also, is your ActiveX an *.OCX or *.Dll file? Theses behave very differently.

I think that you should try and re-solve the hanging rather than trying to find a way to bail-out if the initialize step hangs.

May be able to help further if you show the inside of the initialize ActiveX SubVI.

Anthony.

Link to comment

@Athony: You are right. My problem is, in the initialize ActiveX, I used a register event callback VI node. I tried to use the "initialize array" module to build an array of callback VI reference with only one callback VI reference. I have just tried to create seperate callback VIs and use the "build array" module to build the input reference for my callback register function. And it looks like the problem is solved.

@Ton: your idea is really good. Even my first solution is wrong but when I use your methode, I can handle the hang situation.

I also use the execution.state to track the sate of the VI. If it got hang the state will be "Bad". This is the first time I know how to use this property happy.gif.

Thank you guys.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.