backward-cpp
backward-cpp copied to clipboard
Question: about functionality with Signals
Hello I think your library really cool and I am evaluating if we could use it in the project. So I have the following questions:
- How does the signal handling works since you are using classes like std::vector for in the printer class, which are not to be used while signal handling according to signals cpp?
Best Regards Federico
It works because in real life, most signals are not around failures of the memory allocator (ie: malloc) itself. As long as you can allocate memory, you are pretty ok.
Now, here is an example where backward will deadlock:
- you buffer overflow inside your allocator data structure
- you ask your allocator to free or allocate something
- allocator acquires some locks
- allocator shit itself because its datastructures are corrupted
- signal is raised, backward-cpp kicks in
- while walking the stack, backward-cpp tries to allocate memory, calling your allocator...
- allocator tries to acquires some locks... oops, deadlock.