Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I write to disk and access my C++ objects from a DAQ event callback under Windows 2000?

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.
0 Kudos
Message 1 of 2
(3,056 Views)
NL

I'm not sure if transfering the data to disk is causing the error or not.

The DIG_DB_Transfer should not be giving you a blue screen.

Try to modify this program to transfer the data to disk. I beleive this is very similar to what you are doing, without the transfer to disk. Take a look at the rest of the code outside of the callback function to see if there are any big differences.

Brian
0 Kudos
Message 2 of 2
(3,056 Views)