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

Marcel Holtmann
2004-10-08T16:06:40Z

Hi Stefan,

> Ok, but I don't understand why my problem occurs. Look at this:
> - thread T1 does hci_send_req(read_RSSI), waits for event E1
> - thread T2 does hci_send_req(read_RSSI), waits for event E2
> - Lets assume E2 comes earlier than E1
> Why do BOTH threads receive E2? When is an event consumed?

both are waiting for the next RSSI event and if one occurs both return
with that value. As you already noticed there is no comparison of the
connection handle. All outstanding events are discarded when the socket
descriptor is closed.

Regards

Marcel