John Goodman wrote:
| I have been cautioned about the threading limitations of Bluetooth. I
| understand that Bluetooth must run in a single thread, and that the UI
| must run in the main thread.
Does it necessarily follow that Bluetooth must run in the UI thread? The need for Bluetooth to run in a single thread most likely stems from it having no protection against simultaneous use of data from more than one thread. Unless it has UI components as an integral part of the package, I wouldn't expect it to require the event-dispatch thread to be its single thread. Having a UI on the event-dispatching thread control activity on another thread is a fairly straightforward thing to set up. )The details will depend on exactly what you're trying to achieve, and how Bluetooth does things.) You need to take care that the two threads don't try to use the same thing at the same time, but there are standard tools for that ("synchronized" and Doug Lea's concurrency classes being the most common).
| Also, Apple has a Q&A cautioning against mixing AWT and Cocoa Java
| which recommends using JNI.
One of the big problems is that, if you're not careful, yoy may end up starting *two* event loops, one for Java and one for Cocoa. This isn't conducive to a well-functioning program. (I doubt it's the only problem, but it's one that's been explicitly mentioned by Apple people.)
Glen Fisher
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden