libc/stdio: Remove the one line mutex wrapper

and call nxmutex api directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-11-10 01:20:42 +08:00 committed by Petro Karashchenko
parent 0f2206e9a8
commit 898093a822
4 changed files with 4 additions and 21 deletions

View File

@ -74,13 +74,6 @@ extern "C"
* Public Function Prototypes
****************************************************************************/
/* Defined in lib_streamsem.c */
#ifdef CONFIG_FILE_STREAM
void lib_stream_semtake(FAR struct streamlist *list);
void lib_stream_semgive(FAR struct streamlist *list);
#endif
/* Defined in lib_dtoa.c */
#ifdef CONFIG_LIBC_FLOATINGPOINT

View File

@ -85,7 +85,7 @@ int fclose(FAR FILE *stream)
/* Remove FILE structure from the stream list */
slist = nxsched_get_streams();
lib_stream_semtake(slist);
nxmutex_lock(&slist->sl_lock);
for (next = slist->sl_head; next; prev = next, next = next->fs_next)
{
@ -109,7 +109,7 @@ int fclose(FAR FILE *stream)
}
}
lib_stream_semgive(slist);
nxmutex_unlock(&slist->sl_lock);
/* Check that the underlying file descriptor corresponds to an an open
* file.

View File

@ -59,7 +59,7 @@ int lib_flushall(FAR struct streamlist *list)
/* Process each stream in the thread's stream list */
lib_stream_semtake(list);
nxmutex_lock(&list->sl_lock);
for (i = 0; i < 3; i++)
{
@ -90,7 +90,7 @@ int lib_flushall(FAR struct streamlist *list)
}
}
lib_stream_semgive(list);
nxmutex_unlock(&list->sl_lock);
}
/* If any flush failed, return the errorcode of the last failed flush */

View File

@ -149,13 +149,3 @@ void lib_stream_release(FAR struct task_group_s *group)
}
#endif /* CONFIG_BUILD_FLAT || __KERNEL__ */
void lib_stream_semtake(FAR struct streamlist *list)
{
nxmutex_lock(&list->sl_lock);
}
void lib_stream_semgive(FAR struct streamlist *list)
{
nxmutex_unlock(&list->sl_lock);
}