[Rxtx] Patch
Trent Jarvi
tjarvi at qbang.org
Mon Aug 9 07:10:51 MDT 2010
On Sun, 8 Aug 2010, Adrian Crum wrote:
> The attached patch is cumulative - it includes the previous patches.
>
> A number of changes to make RXTXCommDriver and CommPortIdentifier thread-safe:
>
> 1. Converted CommPortIdentifier linked list to a HashMap and moved it to RXTXCommDriver, put RXTXCommDriver in control of the Map and have CommPortIdentifier delegate method calls to RXTXCommDriver.
>
> There was a flaw in the design. One thread could be traversing the linked list while another thread is modifying it - causing unpredictable results or NPEs.
>
> 2. Synchronized access to the listener Vector in CommPortIdentifier.
>
> 3. Fixed the open method in CommPortIdentifier. Even though the method included synchronized blocks, it was not thread-safe - another thread could change the object's state in the gaps between the synchronized blocks.
>
> This will be my last patch for now. If these changes make it into the
> project, then I will submit more.
>
Thanks Adrian,
I'll be reviewing these and running a test suite on the changes this week.
I'll let you know if I find anything.
--
Trent Jarvi
tjarvi at qbang.org
More information about the Rxtx
mailing list