Getting the output of a Thread

后端 未结 7 1509
时光说笑
时光说笑 2021-02-02 01:28

What do you think is the best way for obtaining the results of the work of a thread? Imagine a Thread which does some calculations, how do you warn the main program the calculat

7条回答
  •  余生分开走
    2021-02-02 01:35

    As noted by saua: use the constructs offered by java.util.concurrent. If you're stuck with a pre 1.5 (or 5.0) JRE, you ,might resort to kind of rolling your own, but you're still better of by using a backport: http://backport-jsr166.sourceforge.net/

提交回复
热议问题