[Bluez-devel] read_RSSI and others not thread-safe?

Stefan Mischke
2004-10-08T12:41:02Z

Hello!

I've written a small JBlueZ-like JNI-Library which gives Java access to
BlueZ. My demo application has one threads for each connection (two at
the moment) which concurrently do read_RSSI, read_Transmit_Power_Level
and read_Link_Quality. If by random two threads do one, two or all three
of these calls at the same time, the result values are equal (although
they can't be since one connection is really bad). This doesn't happen
if I declace the three functions "synchronized" in the Java part of the
JNI. But this should not be necessary, should it? Since my functions
only use by-value parameters and local variables, they should be
thread-safe. I also figured out that the BlueZ sockets in these calls
are unequal, but the result (RSSI value) is equal. Why can this happen?

I wonder if this could also occour on one of the other, more important
functions like l2cap_read/write. Any idea? Thanks!