What kind of code can be called “re-entrant”?

前端 未结 9 1297
时光说笑
时光说笑 2020-12-24 02:34

Could someone tell me what code can be called \"re-entrant\" code?

I came across this word when reading some real time operating system. What disciplines must be st

9条回答
  •  自闭症患者
    2020-12-24 02:56

    John Feminella's answer says:

    a re-entrant block of code is one that can be entered by another actor before an earlier invocation has finished. That is, it is possible to re-enter the code while it's already running.

    But that is also true of non-re-entrant block of code. If the block of code has been written without regard to this issue, it will still be possible for a second actor to enter it simultaneously.

    The issue is what effect this has on the results of either invocation. So more accurately: a re-entrant block is one that can be entered by another actor before an earlier invocation has finished, without changing the outcome of either invocation.

    Neither invocation should be able to detect the "presence" of the other.

提交回复
热议问题