Firmware updater: rework cancelling

This commit is contained in:
Vojtech Kral 2018-05-21 15:24:24 +02:00
parent 4f4649d046
commit a43e72f696
10 changed files with 101 additions and 45 deletions

View file

@ -21,10 +21,10 @@ static void avrdude_message_handler_closure(const char *msg, unsigned size, void
}
// Used by our custom code in avrdude to report progress in the GUI
static bool avrdude_progress_handler_closure(const char *task, unsigned progress, void *user_p)
static void avrdude_progress_handler_closure(const char *task, unsigned progress, void *user_p)
{
auto *progress_fn = reinterpret_cast<AvrDude::ProgressFn*>(user_p);
return (*progress_fn)(task, progress);
(*progress_fn)(task, progress);
}
@ -134,6 +134,11 @@ AvrDude::Ptr AvrDude::run()
return self;
}
void AvrDude::cancel()
{
::avrdude_cancel();
}
void AvrDude::join()
{
if (p && p->avrdude_thread.joinable()) {