I'm writing a PCI-DIO-32HS/Win2K/C++/NI-DAQ-6.9.1 application that uses both double buffering and DAQ Events to stream data to disk. The following callback is called when a half-buffer of data is ready.
void _cdecl acq_callback (HWND _hdl, UINT _msg, WPARAM _wp, LPARAM _lp)
{
// Enter critical section.
// The ACE_GUARD macro creates a sync object that is
// automatically released when the callback returns.
// The global variable is a mutex object.
ACE_GUARD(ACE_Thread_Mutex, ace_mon, lg_lock);
// Allocate the local buffer.
DaqBuffer_Ptr data = new DaqBuffer(CONFIG->hcb_depth());
// Transfer the data into the local buffer.
int err
= DIG_DB_Transfer(. . ., data->base_addr(), data->depth());
// Write data to disk.
ssize_t wlen = ACE_OS::write(file_hndl, data->base_addr(), data->size());
// Post the data to the treatment task.
Message* msg = new Message(data);
treatment_task->put(msg);
}
Unfortunately, I sometimes (let's say once a day) get a Win2K blue screen (error 0x0000000a). Is there something wrong in my code? Can I write to disk and access my C++ objects from a DAQ event callback?
Thanks for your help.
NL.