From 9fc7c7569be4c85b7d26da494870c2b858a05a94 Mon Sep 17 00:00:00 2001 From: Troy Date: Tue, 26 Mar 2024 20:52:55 +0800 Subject: [PATCH] Fix incorrect naming of triggered --- components/libc/posix/io/epoll/epoll.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/libc/posix/io/epoll/epoll.c b/components/libc/posix/io/epoll/epoll.c index 7ecb2d5bf1..43b681e6e4 100644 --- a/components/libc/posix/io/epoll/epoll.c +++ b/components/libc/posix/io/epoll/epoll.c @@ -6,7 +6,9 @@ * Change Logs: * Date Author Notes * 2023-07-29 zmq810150896 first version - * 2024/03/26 TroyMitchelle Add comments for all functions and members within structure members + * 2024/03/26 TroyMitchelle Add comments for all functions, + members within structure members and + fix incorrect naming of triggered */ #include @@ -44,7 +46,7 @@ struct rt_fd_list struct rt_eventpoll { - rt_uint32_t tirggered; /**< Indicates if the wait thread is triggered */ + rt_uint32_t triggered; /**< Indicates if the wait thread is triggered */ rt_wqueue_t epoll_read; /**< Epoll read queue */ rt_thread_t polling_thread; /**< Polling thread */ struct rt_mutex lock; /**< Mutex lock */ @@ -203,7 +205,7 @@ static int epoll_wqueue_callback(struct rt_wqueue_node *wait, void *key) rt_slist_append(&ep->rdl_head, &fdlist->rdl_node); fdlist->exclusive = 0; fdlist->is_rdl_node = RT_TRUE; - ep->tirggered = 1; + ep->triggered = 1; ep->eventpoll_num++; rt_wqueue_wakeup(&ep->epoll_read, (void *)POLLIN); } @@ -678,7 +680,7 @@ static int epoll_wait_timeout(struct rt_eventpoll *ep, int msec) level = rt_spin_lock_irqsave(&ep->spinlock); - if (timeout != 0 && !ep->tirggered) + if (timeout != 0 && !ep->triggered) { if (rt_thread_suspend_with_flag(thread, RT_KILLABLE) == RT_EOK) { @@ -698,7 +700,7 @@ static int epoll_wait_timeout(struct rt_eventpoll *ep, int msec) } } - ret = !ep->tirggered; + ret = !ep->triggered; rt_spin_unlock_irqrestore(&ep->spinlock, level); return ret; @@ -867,7 +869,7 @@ static int epoll_do(struct rt_eventpoll *ep, struct epoll_event *events, int max if (event_num || istimeout) { level = rt_spin_lock_irqsave(&ep->spinlock); - ep->tirggered = 0; + ep->triggered = 0; rt_spin_unlock_irqrestore(&ep->spinlock, level); if ((timeout >= 0) || (event_num > 0)) break;