Recommended practices for re-entrant code in C, C++

前端 未结 4 1636
半阙折子戏
半阙折子戏 2021-02-06 09:16

I was going through a re-entrancy guide on recommended practices when writing re-entrant code.

What other references and resources cover this topic?

What lint-li

4条回答
  •  鱼传尺愫
    2021-02-06 09:34

    The guide is sufficient.

    My personal rule of thumbs are only 2 for re-reentering code:

    1. take only pass by value parameters, used only value passed in as parameters in the function.

    2. if I need to use any global parameters or pointer (for performance or storage sake), use a mutex or semaphore to control access to it.

提交回复
热议问题