scpi_libgpib: Add mutex to SPoll.

This commit is contained in:
Frank Stettner 2019-04-11 14:33:19 +02:00 committed by Uwe Hermann
parent 87aa1e63e3
commit 6188675b72
1 changed files with 3 additions and 0 deletions

View File

@ -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;