LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

viWaitOnEvent / viTerminate

I wish to terminate a request for reading data (viReadAsync) from a serial port.  In my multi-threaded program, I have one thread waiting indefinitely for something to arrive on the port.  I wish to terminate the request from another thread by calling viTerminate.  The call to viTerminate works just fine: it forces the pending viWaitOnEvent to return.  However, viWaitOnEvent returns VI_SUCCESS, which gives no indication why it returned (terminated? received data?).  How can I determine why viWaitOnEvent returned?
 
I have tried viGetAttribute with VI_ATTR_STATUS with the VI_EVENT_IO_COMPLETION (returned VI_ERROR_INV_OBJECT), the session (returned VI_ERROR_NSUP_ATTR), the context (returned VI_ERROR_INV_OBJECT), and the job ID (returned VI_ERROR_INV_OBJECT).
 
I have also tried to get the number of bytes read with VI_ATTR_RET_COUNT.  The session fails (returned VI_ERROR_INV_OBJECT), VI_EVENT_IO_COMPLETION fail (returned VI_ERROR_INV_OBJECT)...
0 Kudos
Message 1 of 2
(3,729 Views)
Looks like many of your viGetAttribute() calls are all resulting VI_ERROR_INV_OBJECT.  What ViSession did you pass for the viGetAttribute()? For acquiring attributes related to event objects, you must pass ViSession that was returned by viWaitOnEvent() at the last parameter - "outContext" of ViPEvent (=ViObject* = ViSession*) type.

このメッセージは 04-17-2007 10:34 AMに Makoto が編集しています。

Message 2 of 2
(3,726 Views)