NeuronRobotics/nrjavaserial — pull request #5 by PeteSL (2014-02-24 21:43:39+00:00)
Title: Updated version number to match app version number (3.9.0). Altered RXTXPort to use ReentrantReadWriteLock instead of synchronize().

Altered IOLocked and IOLockedMutex to use ReentrantReadWriteLock eliminating all synchronize() statements in the port IO methods. This also eliminates 2 significant timing holes: where a read or write starts before the port is closed and the errant use of the non-atomic boolean closeLock variable. ReadLocks allow for multiple concurrent ReadLocks but do not allow locking with a WriteLock. A WriteLock cannot occur if ReadLocks are outstanding. This is exactly what the authors pre-Java 1.5 were trying to accomplish albeit unsuccessfully.