LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with WaitForSingleObject function

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? 

0 Kudos
Message 1 of 3
(3,319 Views)

(very) related question

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(3,303 Views)

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.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 3 of 3
(3,269 Views)