mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling 1. Add semaphore uninterruptible wait function 2 .Replace semaphore wait loop with a single uninterruptible wait 3. Replace all sem_xxx to nxsem_xxx * Unify the void cast usage 1. Remove void cast for function because many place ignore the returned value witout cast 2. Replace void cast for variable with UNUSED macro
This commit is contained in:
@@ -183,5 +183,5 @@ void nxterm_showcursor(FAR struct nxterm_state_s *priv)
|
||||
|
||||
void nxterm_hidecursor(FAR struct nxterm_state_s *priv)
|
||||
{
|
||||
(void)nxterm_hidechar(priv, &priv->cursor);
|
||||
nxterm_hidechar(priv, &priv->cursor);
|
||||
}
|
||||
|
||||
@@ -94,17 +94,6 @@ void nxterm_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
||||
do
|
||||
{
|
||||
ret = nxterm_semwait(priv);
|
||||
|
||||
/* Check for errors */
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
/* The only expected error is if the wait failed because of it
|
||||
* was interrupted by a signal.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(ret == -EINTR || ret == -ECANCELED);
|
||||
}
|
||||
}
|
||||
while (ret < 0);
|
||||
|
||||
@@ -125,5 +114,5 @@ void nxterm_redraw(NXTERM handle, FAR const struct nxgl_rect_s *rect, bool more)
|
||||
nxterm_fillchar(priv, rect, &priv->bm[i]);
|
||||
}
|
||||
|
||||
(void)nxterm_sempost(priv);
|
||||
nxterm_sempost(priv);
|
||||
}
|
||||
|
||||
@@ -88,11 +88,6 @@ int nxterm_resize(NXTERM handle, FAR const struct nxgl_size_s *size)
|
||||
ret = nxterm_semwait(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
/* The only expected error is if the wait failed because of it was
|
||||
* interrupted by a signal or if the thread was canceled.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(ret == -EINTR || ret == -ECANCELED);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -103,6 +98,6 @@ int nxterm_resize(NXTERM handle, FAR const struct nxgl_size_s *size)
|
||||
priv->wndo.wsize.w = size->w;
|
||||
priv->wndo.wsize.h = size->h;
|
||||
|
||||
(void)nxterm_sempost(priv);
|
||||
nxterm_sempost(priv);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ void nxterm_unregister(FAR struct nxterm_state_s *priv)
|
||||
/* Unregister the driver */
|
||||
|
||||
snprintf(devname, NX_DEVNAME_SIZE, NX_DEVNAME_FORMAT, priv->minor);
|
||||
(void)unregister_driver(devname);
|
||||
unregister_driver(devname);
|
||||
|
||||
/* Free the private data structure */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user