Is C++'s new operator reentrant (or async-safe)?

前端 未结 3 1638
不思量自难忘°
不思量自难忘° 2021-02-08 13:23

The background is in this question of mine. Put shortly, I have to fork in a multithreaded C++ program, so I\'d like to figure out how much I can do when r

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-08 14:15

    Thread-safety and re-entrance are not exactly the same.

    AFAIK, the C++ ISO standard does not guarantee thread-safety for new and delete operators. But g++ implementation does provide thread-safetly (and it's one of the reasons it's slow).

提交回复
热议问题