Best Practice for killing a JavaME 1.2 thread?

后端 未结 3 1356
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 14:43

Question: I\'m interested to know the best practice for killing a long standing operation that is running as a background thread (lets call this thread Wo

3条回答
  •  醉梦人生
    2021-01-22 15:12

    I always believed that passing a flag into background thread in an atomic transaction has been the best way to ask a thread to stop. If it doesn't stop for a while, kill it.

    Well, to add to that, if you believe 2 minutes is a long time, good for you. I'd let the user decide what's a long time with a cancel button.

提交回复
热议问题