Re: IOBluetoothUI thread safe?
site_archiver@lists.apple.com Delivered-To: bluetooth-dev@lists.apple.com Oh well. I'll put it in the main thread. joe On Oct 7, 2005, at 1:00 PM, Eric Brown wrote: - Eric On Oct 7, 2005, at 11:52 AM, Joseph Kelly wrote: joe _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/esb%40apple.com This email sent to esb@apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.a... I've been down the "do it all from the main thread road" many times now, and what worries me most is that one variant of my product will be used from a WNE-CFM (PowerPlant OS 9/OS X) app that's linked to my bluetooth code via the CFBundle apis. In other words, I might not have any say as to when exactly the main run loop will get time IOBluetoothUI is not thread safe. It uses both IOBluetooth and AppKit of which neither are thread safe. Your best bet is to use the main thread as your Bluetooth thread and enqueue any Bluetooth operations to be performed on it. Not ideal, but it should work for you. Background: To operate within my own specific requirements that I need to kick off a bunch of bluetooth operations from any thread (including the main thread) AND also operate within the IOBluetooth requirement that all operations be performed on a same thread, I've spawned a worker thread that handles all bluetooth operations (it gets awakened whenever there are commands placed in a queue and performs the bluetooth operations asynchronously, while the requesting threads are blocked until completion). So, is it safe or even advisable to call into IOBluetoothUI from this worker thread? My wish is to put up the standard bluetooth discovery dialog to let the user choose which device to connect to. The standard wisdom is never run UI from a non-main thread, but I might not have a choice? This email sent to site_archiver@lists.apple.com
participants (1)
-
Joseph Kelly