LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a blocking function that waits for a software event

At a point in my host program I sendto a UDP/IP port.
Now I want to block.
The peripheral recvsfrom and then sendsto a response to the host port.
The host port recvs from and writes to a TSQue
A tsq event is created that causes a tsqRead
What can I do to block the host program from its sendto until the message is available.

I put the host recvfrom in a thread so that it can block and not hang the system.
a write to a tsq causes an event but the function it calls is not blocking.

Can you help?

thanks,
archieb
0 Kudos
Message 1 of 2
(2,971 Views)

I cannot test it now since I have no CVI available here, but I can think to a structure like this.

In your main thread you can place GetUserEvent ( ) function where you want to block: you must be careful that no commit events can be fired in this condition since GetUserEvent returns only when a commit or user-defined event is fired (for example you can put all active controls in NORMAL mode instead of HOT so that no commit events are fired).

Your secondary thread can process you communication and place a PostDeferredCall to the main thread: the deferred callback can fire a user-defined event so that GetUserEvent returns and your program can proceed.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 2
(2,957 Views)