|
3
|
| JRL · 技术社区 · 16 年前 |
|
|
1
3
You might find this simpler.
|
|
|
2
2
毕竟…you have to use a TimerTask in combination with a Timer . I hope this is the final installment :)! You should try something like this:
|
|
|
3
1
Yeap, I think it is possible. You just have to keep somewhere the deadline for the task and then using a
Here's a complete example. It's far from perfect but just is the proof of concept on how should it work.
对于可运行列表,您可以启动一个新的
注意Runnabes没有意识到它们是否会永远运行。 In the code below, I reschedule every second, and the random is within a 10 secs range, but you can reschedule every millisecond, and up to whatever time is reasonable for you. 例如:
With this proof of concept, you could use a queue and put out the runnables while they are executing and put them back when they have finished their execution, instead of using a simple list. Also, there might be some synchronization issues, but with the information you provided I think this would be enough. I hope it helps. |
|
|
ron burgundy · 获取-释放语义是否跨线程传递?[副本] 1 年前 |
|
|
H3007 · 并发运行python子进程似乎不是并发的 1 年前 |
|
|
The Oddler · TVar会阻止读取直到更改吗? 1 年前 |
|
|
Wang Tuma · 使用信号量的c++并发问题:按顺序打印 1 年前 |
|
|
Marcel Batista · 在不同线程中更新密钥时的字典线程安全 2 年前 |
|
|
rico · 当volatile关键字真的是必要的? 2 年前 |