Skip to content

Commit

Permalink
graphics: remove sched_[un]lock
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <[email protected]>
  • Loading branch information
hujun260 committed Jul 28, 2023
1 parent 02153a2 commit 9e8f7f0
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions graphics/nxterm/nxterm_kbdin.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ ssize_t nxterm_read(FAR struct file *filep, FAR char *buffer, size_t len)
* to wake us up.
*/

sched_lock();
priv->nwaiters++;
nxmutex_unlock(&priv->lock);

Expand All @@ -139,13 +138,6 @@ ssize_t nxterm_read(FAR struct file *filep, FAR char *buffer, size_t len)

ret = nxsem_wait(&priv->waitsem);

/* Pre-emption will be disabled when we return. So the
* decrementing nwaiters here is safe.
*/

priv->nwaiters--;
sched_unlock();

/* Did we successfully get the waitsem? */

if (ret >= 0)
Expand All @@ -155,6 +147,12 @@ ssize_t nxterm_read(FAR struct file *filep, FAR char *buffer, size_t len)
ret = nxmutex_lock(&priv->lock);
}

/* Pre-emption will be disabled when we return. So the
* decrementing nwaiters here is safe.
*/

priv->nwaiters--;

/* Was the mutex wait successful? Did we successful re-take the
* mutual exclusion mutex?
*/
Expand Down Expand Up @@ -421,10 +419,6 @@ void nxterm_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)
{
int i;

/* Are there threads waiting for read data? */

sched_lock();

/* Notify all poll/select waiters that they can read from the FIFO */

nxterm_pollnotify(priv, POLLIN);
Expand All @@ -437,8 +431,6 @@ void nxterm_kbdin(NXTERM handle, FAR const uint8_t *buffer, uint8_t buflen)

nxsem_post(&priv->waitsem);
}

sched_unlock();
}

nxmutex_unlock(&priv->lock);
Expand Down

0 comments on commit 9e8f7f0

Please sign in to comment.