Jump to content

How to Wait for Windows Events?


Recommended Posts

I am developing an application (on Windows) that communicates with an industrial I/O network. The driver for the interface to this network allows me to poll the network for new messages, but I can also create an event (using the Windows API CreateEvent function) and register to have that event signalled when new data is available.

This thread at the NI forums led me to use the WaitForSingleObject function to wait for the event to be set. Everything seemed to be on the way to success, until I ran some test code.

It turns out that WaitForSingleObject blocks the entire LabVIEW process (menus/mouseclicks/rest of block diagram/etc.). I can't even, for instance, start one top-level VI running, then start another top-level one that calls WaitForSingleObject, because the WaitForSingleObject blocks everything! Switching the top-level VIs to different execution systems didn't alleviate the problem, either.

Since the entire point of using these events is to enable parallel execution (which LabVIEW is normally pretty good at ;)), I'm kind of exasperated. Basically, I just need the WaitForSingleObject to not block the rest of my code.

Does anyone here have any advice/experience with this? I can think of some rather complicated things to try (involving the application builder), but wanted to ask here before (or while) I go plunging wildly ahead with those.

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.