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

前端 未结 3 1704
不思量自难忘°
不思量自难忘° 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 13:56

    I've looked at both the gcc libsupc++ and clang libc++ source, for replacing the standard-conforming C++ new/delete operators - to support native SIMD alignment requirements on platforms where it wasn't guaranteed by malloc.

    They are basically wrappers for malloc and free with some EH logic, etc. I am not a language lawyer, but unless both have it wrong, I think it's safe to conclude: no, they are not reentrant.

提交回复
热议问题