我的问题是,我只想从多个线程中同时运行的多个线程中返回多个值。每次调用线程并运行时,我都需要一个返回值。请证明我感谢你,我的代码片段看起来像这样,Thread1:我调用java到本地库函数,函数返回整数值。如何从多线程返回值?
public void run() {
double time = System.currentTimeMillis();
println("Thread-1 starts " + time);
ED emot = new ED();
emot.edetect("str");
try {
Thread.sleep(1);
} catch {
}
println("Value: " + emot.getvalue);
i = emot.getvalue;
}
所以你想在最后回到我?你想在哪里使用该值? – stinepike
使用Future和ExecutorService – MadProgrammer
@SinePike是我想为另一个类使用'i'值,但多次运行线程 – VijayRagavan