Mailing Lists: Apple Mailing Lists

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

Re: Java AWT and Bluetooth RFCOMM



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

References: 
 >Java AWT and Bluetooth RFCOMM (From: John Goodman <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.