template<class Key, class Value = unsigned char>
class net::impl::Callstack< Key, Value >
callstack of a thread.
use-cases:
- track debuginfo of call chains
- check if the function calls itself
Each new stackframe links to the previous stackframe and sets itself as stacktop. As callstacks are per-thread, no locking is needed.
Usage
struct Frame {
int line;
const char *func;
Frame(const char *f, int l, const char *fun):
};
void a() {
Frame frame(__FILE__, __LINE__, __func__);
Callstack<Frame>::Context stackframe(&frame);
}
void b() {
Frame frame(__FILE__, __LINE__, __func__);
Callstack<Frame>::Context stackframe(&frame);
a();
}
const char * filename
Definition: pfs_example_component_population.cc:67
- Template Parameters
-
Key | key-type |
Value | value-type to assign to the key |