Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to quit circular async loop?



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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Usb mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/usb/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.