• R/O
  • SSH

提交

标签

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ベータ版移行版。作業部屋IDの綴り修正


Commit MetaInfo

修订版0618cdd02df08006275813246dccc52ccca4eafe (tree)
时间2015-07-30 11:56:49
作者MirrgieRiana Kurilab
CommiterMirrgieRiana Kurilab

Log Message

OutputFluorine: 特定の条件下でのデッドロックの解消

更改概述

差异

diff -r ff0d8de23e73 -r 0618cdd02df0 workspace/mirrg.serial.fluorine/src/main/java/mirrg/serial/fluorine/connection/OutputFluorine.java
--- a/workspace/mirrg.serial.fluorine/src/main/java/mirrg/serial/fluorine/connection/OutputFluorine.java Thu Jul 30 04:26:08 2015 +0900
+++ b/workspace/mirrg.serial.fluorine/src/main/java/mirrg/serial/fluorine/connection/OutputFluorine.java Thu Jul 30 11:56:49 2015 +0900
@@ -3,7 +3,6 @@
33 import java.io.OutputStream;
44 import java.io.PrintStream;
55 import java.io.UnsupportedEncodingException;
6-import java.util.Iterator;
76 import java.util.LinkedList;
87
98 import mirrg.serial.fluorine.encode.EncoderAcsOperator;
@@ -47,13 +46,21 @@
4746 try {
4847 while (true) {
4948
50- synchronized (sendingAcsElements) {
51- Iterator<IAcsElement> iterator = sendingAcsElements.iterator();
52- while (iterator.hasNext()) {
53- IAcsElement acsElement = iterator.next();
49+ while (true) {
50+
51+ IAcsElement acsElement = null;
52+ synchronized (sendingAcsElements) {
53+ if (!sendingAcsElements.isEmpty()) {
54+ acsElement = sendingAcsElements.removeFirst();
55+ }
56+ }
57+
58+ if (acsElement != null) {
5459 sendImpl(acsElement.get(), listener);
55- iterator.remove();
60+ } else {
61+ break;
5662 }
63+
5764 }
5865
5966 Thread.sleep(5);