Go to file
chao an df30a1f8d3 sched/pthread/join: refactor pthread join to support join task
1. add support to join main task

| static pthread_t self;
|
| static void *join_task(void *arg)
| {
|   int ret;
|   ret = pthread_join(self, NULL);          <---  /* Fix Task could not be joined */
|   return NULL;
| }
|
| int main(int argc, char *argv[])
| {
|   pthread_t thread;
|
|   self = pthread_self();
|
|   pthread_create(&thread, NULL, join_task, NULL);
|   sleep(1);
|
|   pthread_exit(NULL);
|   return 0;
| }

2. Detach active thread will not alloc for additional join, just update the task flag.
3. Remove the return value waiting lock logic (data_sem),
   the return value will be stored in the waiting tcb.
4. Revise the return value of pthread_join(), consistent with linux
   e.g:
       Joining a detached and canceled thread should return EINVAL, not ESRCH

   https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_join.html

   [EINVAL]
      The value specified by thread does not refer to a joinable thread.

NOTE:

This PR will not increase stack usage, but struct tcb_s will increase 32 bytes.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-13 18:06:56 +09:00
.github ci: Remove the codecheck from build.yml 2024-02-29 18:54:41 -03:00
arch riscv/k230: add ARCH_HAVE_RESET revise logging 2024-03-13 13:46:02 +08:00
audio Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
binfmt binfmt/task/member: remove invaild membership reverse 2024-03-07 22:53:19 +08:00
boards sim/nxcamera: add CONFIG_SIM_FBBPP=32 2024-03-13 12:33:07 +08:00
cmake build/cmake: fix empty BASE_DEFCONFIG string 2024-02-28 10:58:52 +01:00
crypto sched: explicitly select the cpuload clock source configuration 2023-11-01 09:27:56 +08:00
Documentation arch/esp32 add openeth mac driver 2024-03-12 08:31:06 -03:00
drivers Refactor nuttx v4l2 2024-03-13 09:51:08 +08:00
dummy build: add initial cmake build system 2023-07-08 13:50:48 +08:00
fs fs/mount: harden nx_mount logic 2024-03-12 19:44:48 +08:00
graphics poll: pollsetup should notify only one fd passd by caller 2023-11-21 09:07:17 +01:00
include sched/pthread/join: refactor pthread join to support join task 2024-03-13 18:06:56 +09:00
libs libs/libc/string: fix memmem() boundary case when needle is at end of haystack 2024-03-11 22:06:19 +08:00
mm mm_heap/mm.h: revising comments 2024-03-12 19:44:48 +08:00
net net/local: Fix the wrong direction of threshold setting 2024-03-10 11:44:33 -03:00
openamp openamp: Fix void pointer arithmetic in openamp to remove compilation warnings 2024-02-12 17:06:33 +01:00
pass1
sched sched/pthread/join: refactor pthread join to support join task 2024-03-13 18:06:56 +09:00
syscall sched/semaphore: Move named semaphores to user space 2023-11-27 04:52:54 -08:00
tools Fix cmake-format wrong execution order 2024-03-12 20:03:15 +08:00
video build: add initial cmake build system 2023-07-08 13:50:48 +08:00
wireless Remove the back slash from long literal string 2024-02-19 16:43:15 +01:00
.asf.yaml
.gitignore fs/vfat: Fix typo in the macro DIRSEC_BYTENDX 2024-02-03 12:46:08 -03:00
.yamllint
AUTHORS AUTHORS: add Tomek CEDRO to the list 2023-03-07 14:15:55 +01:00
CMakeLists.txt Use C++ standard lib from toolchain 2024-03-06 08:42:44 +08:00
CONTRIBUTING.md Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00
INVIOLABLES.md
Kconfig rpmsg/debug: add debug configs and macros 2024-02-15 19:53:55 -08:00
LICENSE api: add simple hashtable api 2024-02-21 13:29:36 -03:00
Makefile
NOTICE
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.