Home  >  Q&A  >  body text

java线程执行yield()后就会让出cpu ,那之后如何恢复啊?

java线程执行yield()后就会让出cpu
那之后如何恢复啊?

ringa_leeringa_lee2744 days ago645

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:49:13

    Yield is not sure to give up the CPU, and does not need to be restored, just wait for scheduling. This method is generally rarely used.

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 10:49:13

    Thanks for correcting me
    I misremembered

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 10:49:13

    Wait for the thread scheduler to allocate CPU time slices to you later. But calling the yield method is just a suggestion, telling the thread scheduler that my work is almost done and that other threads of the same priority can use the CPU. There is no mechanism to guarantee adoption.

    reply
    0
  • Cancelreply