You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/11/09 20:38:18 UTC
[incubator-nuttx] 01/02: libc/stdio: Remove the one line mutex wrapper
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 898093a822ee6d8e14f459565d87c66db9d9dd23
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Thu Nov 10 01:20:42 2022 +0800
libc/stdio: Remove the one line mutex wrapper
and call nxmutex api directly
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
libs/libc/libc.h | 7 -------
libs/libc/stdio/lib_fclose.c | 4 ++--
libs/libc/stdio/lib_libflushall.c | 4 ++--
libs/libc/stdio/lib_libstream.c | 10 ----------
4 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/libs/libc/libc.h b/libs/libc/libc.h
index a295e89a1a..1f537493ef 100644
--- a/libs/libc/libc.h
+++ b/libs/libc/libc.h
@@ -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
diff --git a/libs/libc/stdio/lib_fclose.c b/libs/libc/stdio/lib_fclose.c
index 8588a0406d..54812c7ef2 100644
--- a/libs/libc/stdio/lib_fclose.c
+++ b/libs/libc/stdio/lib_fclose.c
@@ -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.
diff --git a/libs/libc/stdio/lib_libflushall.c b/libs/libc/stdio/lib_libflushall.c
index 8e3879b11c..11bda4577d 100644
--- a/libs/libc/stdio/lib_libflushall.c
+++ b/libs/libc/stdio/lib_libflushall.c
@@ -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 */
diff --git a/libs/libc/stdio/lib_libstream.c b/libs/libc/stdio/lib_libstream.c
index 07461eb88e..3931744271 100644
--- a/libs/libc/stdio/lib_libstream.c
+++ b/libs/libc/stdio/lib_libstream.c
@@ -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);
-}