break from long loops on shutdown request
In loops that typically take longer time to complete, check if there is a pending shutdown request. If so, terminate the loop. This allows to respond to a signal requesting a shutdown during some loops which do not return control to main OpenOCD loop. Change-Id: Iace0b58eddde1237832d0f9333a7c7b930565674 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Reviewed-on: https://review.openocd.org/c/openocd/+/8032 Reviewed-by: Jan Matyas <jan.matyas@codasip.com> Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
e8e09b1b55
commit
2e920a212f
@@ -24,6 +24,7 @@
|
||||
#include "image.h"
|
||||
#include "target.h"
|
||||
#include <helper/log.h>
|
||||
#include <server/server.h>
|
||||
|
||||
/* convert ELF header field to host endianness */
|
||||
#define field16(elf, field) \
|
||||
@@ -1295,6 +1296,8 @@ int image_calculate_checksum(const uint8_t *buffer, uint32_t nbytes, uint32_t *c
|
||||
crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buffer++) & 255];
|
||||
}
|
||||
keep_alive();
|
||||
if (openocd_is_shutdown_pending())
|
||||
return ERROR_SERVER_INTERRUPTED;
|
||||
}
|
||||
|
||||
LOG_DEBUG("Calculating checksum done; checksum=0x%" PRIx32, crc);
|
||||
|
||||
Reference in New Issue
Block a user