08-11-2014 07:23 AM
Hello everyone.
I have a problem with calling WaitForSingleObject function in LabVIEW. I use a VI, in which an event is created (CreateEvent function) and a handle to that event is passed to the outpot of the VI. This part works just fine, the handle is nonzero etc.
The problem occurs when I want to use that handle to call a WaitForSingleObjectFunction. I have connected the wires as shown in the attached picture.
The first parameter is a handle received from that previous VI.
The inifinite symbol is for infinite timeout.
Whenever I try to run this code, LabVIEW is immediately closed, without event displaying any error dialog.
Since the handle seems to be OK, I suspected the infinite parameter to cause, but same thing happens with 0 or any other value passed as timeout value.
Any ideas what's going on in this case?
08-11-2014 08:11 AM
(very) related question…
08-12-2014 05:39 AM - edited 08-12-2014 05:43 AM
In your Call Library Function Node (CLFN), go to the Error Checking tab and select Maximum. This will cause LV to take extra precautions when calling the dll and might help prevent the crash, allowing you to experiment with different calling parameters etc.
The WaitForSingleObject function does not take a floating point input at the second parameter. Your coercion dot shows that you're asking LabVIEW to coerce a positive infinity to an integer, which isn't going to work. Read the MSDN help on this call to learn that the timeout is in milliseconds, and "infinite" is a special case of 0xFFFFFFF. Use the maximum an unsigned 32-bit value can hold, which is 4294967295. This is the special infinite case.