Apache NuttX is a mature, real-time embedded operating system (RTOS) https://nuttx.apache.org/
Find a file
ouyangxiangzhen 900b1c19dd wqueue: improve the robustness of the work
struct work_s
{
  union
  {
    struct
    {
      struct dq_entry_s dq;      /* Implements a double linked list */
      clock_t qtime;             /* Time work queued */
    } s;
    struct wdog_s timer;         /* Delay expiry timer */
    struct wdog_period_s ptimer; /* Period expiry timer */
  } u;
  worker_t  worker;              /* Work callback */
  FAR void *arg;                 /* Callback argument */
  FAR struct kwork_wqueue_s *wq; /* Work queue */
};

work_cancel() should determine whether the current work is
in the timer or has already entered the queue.
This judgment is indispensable because the structure is a union.
Whether it is interpreted as a timer or as a dq needs to be determined.

But this judgment seriously depends on the order of struct wdog_s and
struct dq_entry_s, once someone change the order of any, there is a bug.
So we decide remove the union, to improve the robustness.

For the work_s structure size will grow bigger, then we will provide a
another optimization patch

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-07 02:02:10 +08:00
.github ci: enable spelling checks (via codespell) 2025-05-05 12:34:39 +08:00
arch espressif: Add variable to override MCUboot version and URL 2025-05-07 01:51:40 +08:00
audio audio/composite: merge composite instance allocate to one times 2025-03-17 10:26:54 +01:00
binfmt libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
boards boards/arm/stm32f7/nucleo-f767zi: enhance button support 2025-05-05 20:14:23 -03:00
cmake tools: Update Unix.mk and savedefconfig.cmake for CONFIG_ARCH_BOARD_COMMON 2025-05-02 09:30:34 -03:00
crypto crypto/xform.c: migrate to SPDX identifier 2024-12-19 14:48:18 +08:00
Documentation docs/xtensa: Added chip tags 2025-05-06 19:19:56 +02:00
drivers drivers/video/fb.c: Add startup splashscreen option 2025-04-30 06:38:05 -03:00
dummy build: add initial cmake build system 2023-07-08 13:50:48 +08:00
fs fs/procfs: Improve subdirectory recognition 2025-05-02 09:28:06 -03:00
graphics move readv/writev to the kernel 2024-10-30 17:07:54 +08:00
include wqueue: improve the robustness of the work 2025-05-07 02:02:10 +08:00
libs wqueue: improve the robustness of the work 2025-05-07 02:02:10 +08:00
mm libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
net net/tcp/tcp_conn.c: optimize the port conflict detection rules 2025-04-24 14:10:27 +08:00
openamp Remove all jira and changeid information from the kernel 2024-11-06 02:04:03 +08:00
pass1 Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
sched sched/signal/sig_dispatch: Fix race conditions between nxsig_tcbdispatch and nxsig_deliver 2025-05-02 09:21:14 -03:00
syscall sched/gettid: Move thread ID to TLS 2025-04-08 22:53:10 +08:00
tools tools/process_config: remove unused unnecessary printing 2025-05-05 23:49:16 +08:00
video Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
wireless wireless/ieee802154: Replace direct access to semaphore value with nxsem_get_value 2025-04-17 20:13:40 +08:00
.asf.yaml feat: add a GitHub action to lint the YAML files 2020-12-15 09:52:04 -06:00
.codespell-ignore-lines style: add codespell configuration for common spelling exceptions 2025-05-05 12:34:39 +08:00
.codespellrc style: add codespell configuration for common spelling exceptions 2025-05-05 12:34:39 +08:00
.gitignore gitignore: add Emacs auto-save files 2025-01-15 16:10:22 +08:00
.pre-commit-config.yaml pre-commit: enable codespell checks 2025-05-05 12:34:39 +08:00
.yamllint feat: add a GitHub action to lint the YAML files 2020-12-15 09:52:04 -06:00
AUTHORS AUTHORS: add Yamamoto Takashi 2024-11-04 22:29:22 +08:00
CMakeLists.txt Documentation: fix typo in comments 2025-04-11 22:31:30 +08:00
CONTRIBUTING.md 202503 Apache NuttX RTOS Contributing Guidelines update. 2025-03-17 08:30:37 -03:00
INVIOLABLES.md INVIOLABLES.md: Fix a simple alignment and change occurrences of Nuttx 2020-09-03 01:33:05 +08:00
Kconfig libc/elf: rename modlib to libelf 2025-04-11 09:43:22 +08:00
LICENSE libc string:Separate code. 2024-10-23 09:49:19 +08:00
Makefile tools: migrate to SPDX identifier 2024-09-10 23:11:11 +08:00
NOTICE Remove the double blank line from source files 2022-02-20 20:10:14 +01:00
README.md Gathering community recommendations 2023-10-28 13:55:56 +08:00
ReleaseNotes Documentation: move ReleaseNotes 2023-09-26 20:41:00 +08:00

POSIX Badge License Issues Tracking Badge Contributors GitHub Build Badge Documentation Badge

Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).

For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.

Getting Started

First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.

Documentation

You can find the current NuttX documentation on the Documentation Page.

Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.

The old NuttX documentation is still available in the Apache wiki.

Supported Boards

NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.

Contributing

If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.

License

The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.