Add ThreadIdGuard to tests and tg_cli.

This commit is contained in:
levlam 2021-11-18 16:25:37 +03:00
parent 6f3dc2afb1
commit 2b9b9f0c31
3 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@
#include "td/utils/misc.h"
#include "td/utils/NullLog.h"
#include "td/utils/OptionParser.h"
#include "td/utils/port/detail/ThreadIdGuard.h"
#include "td/utils/port/FileFd.h"
#include "td/utils/port/PollFlags.h"
#include "td/utils/port/signals.h"
@ -4593,6 +4594,7 @@ static void on_log_message(int verbosity_level, const char *message) {
void main(int argc, char **argv) {
ExitGuard exit_guard;
detail::ThreadIdGuard thread_id_guard;
ignore_signal(SignalType::HangUp).ensure();
ignore_signal(SignalType::Pipe).ensure();
set_signal_handler(SignalType::Error, fail_signal).ensure();

View File

@ -11,6 +11,7 @@
#include "td/utils/common.h"
#include "td/utils/crypto.h"
#include "td/utils/logging.h"
#include "td/utils/port/detail/ThreadIdGuard.h"
#include "td/utils/ScopeGuard.h"
#include "td/utils/SharedSlice.h"
#include "td/utils/Slice.h"
@ -274,6 +275,7 @@ static HandshakeTest pregenerated_test() {
}
int main() {
td::detail::ThreadIdGuard thread_id_guard;
auto test = gen_test();
run_test(test);
run_test(pregenerated_test());

View File

@ -8,6 +8,7 @@
#include "td/utils/crypto.h"
#include "td/utils/logging.h"
#include "td/utils/OptionParser.h"
#include "td/utils/port/detail/ThreadIdGuard.h"
#include "td/utils/Slice.h"
#include "td/utils/tests.h"
@ -16,6 +17,7 @@
#endif
int main(int argc, char **argv) {
td::detail::ThreadIdGuard thread_id_guard;
td::init_openssl_threads();
td::TestsRunner &runner = td::TestsRunner::get_default();