On Nov 17, 2005, at 6:37 AM, Geoffrey Schmit wrote:
I've ensured that my framework functions that end up calling into the IOBluetoothUI framework are always called on the application's UI thread. If I ensure this, what problems would I encounter if I create a thread that is responsible for calling into the IOBluetooth framework and have my other framework functions pass messages to this thread?
I tried that method (IOBluetoothUI on the main thread, and IOBluetooth from other threads) and it was generally unstable -- calls into IOBluetoothUI would occasionally hang or crash (this was on 10.4.2, Xcode 2.2. preview). When I moved all bluetooth api calls into the main thread, and used the provided async calls whenever possible, it all started running much smoother.
In other words, I think IOBluetoothUI relies on objects used by IOBluetooth, and the access is not synchronized. The Apple engineers, who have been very helpful, could probably elaborate.
If I create a thread using pthreads, will that thread have an associated run loop or do I have to create one explicitly? The documentation I've read was not clear on this point.
Run loop creation/destruction is handled automatically.