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:
Xiang Xiao
2020-01-02 10:49:34 -06:00
committed by Gregory Nutt
parent 316675f4db
commit 6a3c2aded6
1602 changed files with 6311 additions and 10874 deletions
+1 -1
View File
@@ -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);
}
+1 -12
View File
@@ -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);
}
+1 -6
View File
@@ -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;
}
+1 -1
View File
@@ -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 */