09-21-2007 02:59 PM
MsgWaitForMultipleObjects
function with NI-DAQ events or am I stuck with callback functions?
John
09-21-2007 04:24 PM
For example:
switch
( MsgWaitForMultipleObjects (1, &pMyEvent, FALSE, INFINITE, QS_ALLEVENTS ) ){ case WAIT_OBJ_DATA_MY_EVENT_HAS_ARRIVED: /************************************************/::ResetEvent (myEvent);
Process My Event
/************************************************/
break; case WAIT_OBJ_WINDOWS_MSG: while ( PeekMessage ( &msg, NULL, 0, 0, PM_REMOVE ) ){ if ( msg.message == WM_NI_DAQ EVENT??Process DAQmx Event
break;}
DispatchMessage (&msg);
}
break;
John
09-24-2007 04:31 PM
09-25-2007 09:02 AM
Paul,
We typically structure our services to have two threads. An interface thread and a worker thread. What I want is the worker thread to wait for the message event to process the DIO state change. The interface thread is to manage the outside world connections into the class/object. We already have this struture setup and I was hoping to utilize it. I haven't worked much with callbacks so I cannot speak on how well they work, etc. What happens if the callback is in process and another event happens? Do I lose it? Is it processed off a queue on the DAQmx thread?
John
09-26-2007 01:53 PM
09-26-2007 04:23 PM