RT-Thread / RT-Thread/rt-thread

wait queue 中 __wqueue_default_wake 永远返回的是 0

Open
#4,368 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

在等待队列使用的时候会

int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int msec)
{
    __wait.polling_thread = rt_thread_self();
    __wait.key = 0;
    __wait.wakeup = __wqueue_default_wake;

但是 wake up 这个函数的设计初衷应该是由用户自己来实现这个唤醒函数吧,但是这里默认写了永远返回 0,看起来这个设计是不合理的。

int __wqueue_default_wake(struct rt_wqueue_node *wait, void *key)
{
    return 0;
}

那么设计这个函数的时候,是不是可以考虑增加一个形参或者其他的方式,让用户可以自定义自己的 wake up 函数。

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue points to rt_wqueue_wait and __wqueue_default_wake; start by tracing how the wait node's wake callback is selected and how its return value is consumed. Since no file, test, or exact API is specified, first resolve the intended customization contract with maintainers; done means an agreed behavior and regression coverage for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.