aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/actor/what_thread_does.h
blob: 235d2c3700fcfd75ad8a2f073c482082521ef6c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

const char* PushWhatThreadDoes(const char* what);
void PopWhatThreadDoes(const char* prev);
const char** WhatThreadDoesLocation();

struct TWhatThreadDoesPushPop {
private:
    const char* Prev;

public:
    TWhatThreadDoesPushPop(const char* what) {
        Prev = PushWhatThreadDoes(what);
    }

    ~TWhatThreadDoesPushPop() {
        PopWhatThreadDoes(Prev);
    }
};

#ifdef __GNUC__
#define WHAT_THREAD_DOES_FUNCTION __PRETTY_FUNCTION__
#else
#define WHAT_THREAD_DOES_FUNCTION __FUNCTION__
#endif

#define WHAT_THREAD_DOES_PUSH_POP_CURRENT_FUNC() \
    TWhatThreadDoesPushPop whatThreadDoesPushPopCurrentFunc(WHAT_THREAD_DOES_FUNCTION)