| 88 | } |
| 89 | |
| 90 | void* ThreadProcParent(void*) { |
| 91 | const TString setName = "Parent"; |
| 92 | TThread::SetCurrentThreadName(setName.data()); |
| 93 | |
| 94 | TThread thread(&ThreadProcChild, nullptr); |
| 95 | |
| 96 | thread.Start(); |
| 97 | thread.Join(); |
| 98 | |
| 99 | const auto getName = TThread::CurrentThreadName(); |
| 100 | if (TThread::CanGetCurrentThreadName()) { |
| 101 | UNIT_ASSERT_VALUES_EQUAL(setName, getName); |
| 102 | } else { |
| 103 | UNIT_ASSERT_VALUES_EQUAL("", getName); |
| 104 | } |
| 105 | return nullptr; |
| 106 | } |
| 107 | |
| 108 | Y_UNIT_TEST(TestSetThreadName) { |
| 109 | TThread thread(&ThreadProc, nullptr); |