Hello,
My application uses a separate thread to do consecutive async reads
from a device. I am using a circular buffer configuration in which
the thread initially calls 4 reads and then there are 4 callbacks,
each callback immediately calls another read. It runs fine.
However, i'm a little confused as to how I should stop all this
once it is going. Is calling CFRunLoopStop(CFRunLoopCurrent())
from one of the callbacks enough? Or should I call it from every
call back? The callbacks are called sequentially as the reads are
completed. I'm not sure if once CFRunLoopStop is called from one
of the callbacks, all the reads stop and CFRunLoop() returns in the
original thread or not. This is confusing to me because it seems
like there are still waiting async USB calls, that will try to do
callbacks. Should I be calling ClearPipeStall()?
My program communicates with the threads using a single variable,
when my program sets it to a particular value, the callbacks know
it's time to stop. The question is how to do it correctly.
Thanks for any help.
Juan