- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I start a thread to recive the data.
In the thread, there are 2 buffers. BufA and BufB. When one of them is full, the other one will collect the data.
I'll do this loop with WaitForXfer, FinishDataXfer,BeginDataXfer。
BeginDataXfer()
while(1) {
if(flag) {
buf=bufA
buf_next=bufB
}else{
buf_nex=bufA
buf=bufB
}
flag=!flag
WaitForXfer(buf)
FinishDataXfer(buf)
BeginDataXfer(buf_next)
//..........
}
I found that, Once the FinishDataXfer fails, the data you received next time is not in buf, but in buf_next.
Is that possible?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, according to your code this is the expected behavior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
if it fails, of course there can't be data in the actual buffer.
Try to detect a fail and if it fails then discard the data(buffer content) of the failed transfer.
Also it is better to begin the second transfer before you wait for the first transfer to finish.
That way the driver can fill the next buffer with data as soon as the actual buffer is full and while you empty it.