Add G() debug.

GitOrigin-RevId: 0ccc0d43c93186add1119fa2d72e8c669cfa6dd3
This commit is contained in:
levlam 2019-09-08 03:10:09 +03:00
parent 8b961d9ed1
commit cb69109ccb
3 changed files with 8 additions and 4 deletions

View File

@ -78,6 +78,7 @@ class Global : public ActorContext {
LOG_CHECK(td_db_) << close_flag() << " " << file << " " << line;
return td_db_.get();
}
void close_all(Promise<> on_finished);
void close_and_destroy_all(Promise<> on_finished);
@ -425,10 +426,12 @@ class Global : public ActorContext {
void do_close(Promise<> on_finish, bool destroy_flag);
};
inline Global *G() {
#define G() G_impl(__FILE__, __LINE__)
inline Global *G_impl(const char *file, int line) {
ActorContext *context = Scheduler::context();
CHECK(context);
CHECK(context->get_id() == Global::ID);
LOG_CHECK(context->get_id() == Global::ID) << "In " << file << " at " << line;
return static_cast<Global *>(context);
}

View File

@ -39,7 +39,8 @@
#include <tuple>
#include <type_traits>
#define G GLOBAL_SHOULD_NOT_BE_USED_HERE
//#define G GLOBAL_SHOULD_NOT_BE_USED_HERE
#undef G
namespace td {

View File

@ -22,7 +22,7 @@ namespace td {
#define get_erase_logevent_promise(...) get_erase_logevent_promise_impl(__FILE__, __LINE__, __VA_ARGS__)
inline Promise<Unit> get_erase_logevent_promise_impl(const char *file, int32 line, uint64 logevent_id,
inline Promise<Unit> get_erase_logevent_promise_impl(const char *file, int line, uint64 logevent_id,
Promise<Unit> promise = Promise<Unit>()) {
if (logevent_id == 0) {
return promise;