09-21-2009 01:51 PM
Hi
I am trying to implement a non-blocking read along the lines of peekdata() in matlab http://www.mathworks.de/access/helpdesk/help/toolbox/daq/index.html?/access/helpdesk/help/toolbox/da...
I found that I can do non-blocked reads using read + callbacks http://forums.ni.com/ni/board/message?board.id=230&thread.id=2862
Is there another way to achieve non-blocking reads? The reason is that if i implement the above using matlab's mex interface, Matlab calls the (mex) C file and i have to do the read (has to wait for the trigger to happen) before returning back from the C file (aka again it becomes blocking). So callbacks are not really useful if thought in a single-threaded way that matlab works.
thanks for reading.
Solved! Go to Solution.
09-22-2009 01:12 PM
09-22-2009 06:45 PM
Thanks a lot.
I was able to get around implementing a non-blocking read in mex was via two threads, one always reading in the background and the other polling it.