I got this exception in my program: 0x00007FFD187CF61E (ucrtbase.dll) My project is C++/MFC and source is below.
I confirm this code works in my other project which is a console project.
ReloadWatchdog.h
#pragma once
class ReloadWatchdog
{
public:
static void Reload();
};
ReloadWatchdog.cpp
#include "pch.h"
#include "ReloadWatchdog.h"
#include <thread>
void ReloadWatchdog::Reload()
{
while (true)
{
using namespace std::chrono_literals;
std::this_thread::sleep_for(std::chrono::minutes(4));
try {
call_method();
}
catch (...) {
}
}
}
main
BOOL CWatchDogPI336Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// ↓this occured exception
std::thread th1(ReloadWatchdog::Reload);
return TRUE;
}