diff options
Diffstat (limited to 'nuttx/graphics/nxconsole/nxcon_driver.c')
-rwxr-xr-x | nuttx/graphics/nxconsole/nxcon_driver.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/nuttx/graphics/nxconsole/nxcon_driver.c b/nuttx/graphics/nxconsole/nxcon_driver.c index 58ad027fe..60ed3242a 100755 --- a/nuttx/graphics/nxconsole/nxcon_driver.c +++ b/nuttx/graphics/nxconsole/nxcon_driver.c @@ -126,12 +126,21 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer, FAR struct nxcon_state_s *priv; char ch; int lineheight; + int ret; /* Recover our private state structure */ DEBUGASSERT(filep && filep->f_priv); priv = (FAR struct nxcon_state_s *)filep->f_priv; + /* Get exclusive access */ + + ret = sem_wait(&priv->exclsem); + if (ret < 0) + { + return ret; + } + /* Loop writing each character to the display */ lineheight = (priv->fheight + CONFIG_NXCONSOLE_LINESEPARATION); @@ -185,6 +194,7 @@ static ssize_t nxcon_write(FAR struct file *filep, FAR const char *buffer, nxcon_putc(priv, (uint8_t)ch); } + sem_post(&priv->exclsem); return buflen; } |