In the BluetoothChat demo (BluetoothChatService), there is a function
which performs an unsynchronized write to the ConnectedThread.write()
function. Its documented this way, so its clear that the developer did
this for a reason ... but I don't understand how this could work
reliably

    public void write(byte[] out) {
        // Create temporary object
        ConnectedThread r;
        // Synchronize a copy of the ConnectedThread
        synchronized (this) {
            if (mState != STATE_CONNECTED) return;
            r = mConnectedThread;
        }
        // Perform the write unsynchronized
        r.write(out);
    }

ConnectedThead's write is not synchronized in any way.

Does anyone have any ideas?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to