Санитайзер говорит о рейсах здесь, объясните мне пожалуйста - что здесь не так? Всё под мьютексом.
#include <mutex>
#include <thread>
#include <chrono>
#include <condition_variable>
#include <queue>
#include <memory>
using namespace std;
struct Mes {
	int data = 0;
	bool processed = false;
};
struct Test {
	mutex mtx;
	condition_variable cv;
	queue<weak_ptr<Mes>> mes_queue;
	int read();
	bool check();
} t;
int Test::read()
{
	auto sh_ptr = make_shared<Mes>();
	unique_lock lck{mtx};
	mes_queue.push(sh_ptr);
	while (! cv.wait_for(lck, 1s, [&sh_ptr](){
				return sh_ptr->processed == true;})  &&  true);
	return sh_ptr->data;
}
bool Test::check()
{
	scoped_lock lck{mtx};
	bool ret = mes_queue.size();
	while (mes_queue.size()) {
		if (shared_ptr<Mes> mes = mes_queue.front().lock()) {
			mes->data = 5;
			mes->processed = true;
		}
		mes_queue.pop();
	}
	cv.notify_all();
	return ret;
}
void read_th() {
	while (true) {
		t.read();
		this_thread::sleep_for(200ms);
	}
}
void check_th() {
	while (true) {
		t.check();
		this_thread::sleep_for(200ms);
	}
}
int main() {
	jthread tr{read_th};
	jthread tc{check_th};
}
$ g++ -pthread -std=c++20 -fsanitize=thread test.cc
Выхлоп санитайзера весьма обилен, вставил сюда, но главное то, что жалобы на рейсы в полностью валидном коде (на мой взгляд).

