implement destructor

This commit is contained in:
Siegfried Kienzle
2017-06-15 19:09:29 +02:00
parent 68433fc531
commit c9bbfff992
2 changed files with 6 additions and 5 deletions

View File

@@ -10,10 +10,10 @@ rfid_reader::rfid_reader()
thread = std::thread(&rfid_reader::loop, this);
}
~rfid_reader::rfid_reader()
rfid_reader::~rfid_reader()
{
thread.join();
stop_thread = true;
if(thread.joinable()) thread.join();
}
uint32_t rfid_reader::last_id() const
@@ -23,7 +23,7 @@ uint32_t rfid_reader::last_id() const
void rfid_reader::loop()
{
while(true)
while(!stop_thread)
{
if(!mfrc.PICC_IsNewCardPresent())
{