Can I add an attribute to a function to prevent reentry?

前端 未结 9 2322
梦谈多话
梦谈多话 2021-02-15 12:26

At the moment, I have some functions which look like this:

private bool inFunction1 = false;
public void function1()
{
    if (inFunction1) return;
    inFunctio         


        
9条回答
  •  隐瞒了意图╮
    2021-02-15 13:12

    You may want to consider avoiding re-entrancy by modifying your design so that it will never call function1() before its previous invocation completes. To me it seems that a layer is missing from above function1().

提交回复
热议问题