synchronizing pending bytes vector
This commit is contained in:
parent
5e6b02d1b9
commit
cdd2d9daa5
|
@ -26,7 +26,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: SkySerial.java,v 1.6 2008/12/03 13:04:21 fros4943 Exp $
|
* $Id: SkySerial.java,v 1.7 2008/12/04 13:09:27 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
|
@ -134,15 +134,19 @@ public class SkySerial extends Log implements SerialPort, USARTListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tryWriteNextByte() {
|
private void tryWriteNextByte() {
|
||||||
if (incomingData.isEmpty()) {
|
byte b;
|
||||||
|
|
||||||
|
synchronized (incomingData) {
|
||||||
|
if (!usart.isReceiveFlagCleared()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!usart.isReceiveFlagCleared()) {
|
if (incomingData.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write byte to serial port */
|
/* Write byte to serial port */
|
||||||
byte b = incomingData.remove(0);
|
b = incomingData.remove(0);
|
||||||
|
}
|
||||||
usart.byteReceived(b);
|
usart.byteReceived(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue