From: Frank Stettner Date: Thu, 11 Apr 2019 12:33:19 +0000 (+0200) Subject: scpi_libgpib: Add mutex to SPoll. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=6188675b72990ee3f76b465e6020b38792604130;p=libsigrok.git scpi_libgpib: Add mutex to SPoll. --- diff --git a/src/scpi/scpi_libgpib.c b/src/scpi/scpi_libgpib.c index 26fcadac..5c82bd6f 100644 --- a/src/scpi/scpi_libgpib.c +++ b/src/scpi/scpi_libgpib.c @@ -169,13 +169,16 @@ SR_PRIV int sr_scpi_gpib_spoll(struct sr_scpi_dev_inst *scpi, char *buf) { struct scpi_gpib *gscpi = scpi->priv; + g_mutex_lock(&scpi->scpi_mutex); ibrsp(gscpi->descriptor, buf); if (ibsta & ERR) { sr_err("Error while serial polling: iberr = %s.", gpib_error_string(iberr)); + g_mutex_unlock(&scpi->scpi_mutex); return SR_ERR; } + g_mutex_unlock(&scpi->scpi_mutex); sr_spew("Successful serial poll: 0x%x", (uint8_t)buf[0]); return SR_OK;