16 Commits

Author SHA1 Message Date
Saiiijchan
14ee4b2c7c Fix detach race condition (#43)
* Fix detach race condition

pxThread->xAttr.usSchedPriorityDetachState may be changed by
pthread_detach(). Suspend scheduler to prevent race condition.

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>

* Fix compiler warnings

---------

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: Rahul Kar <karahulx@amazon.com>
2025-04-04 13:03:23 +05:30
Saiiijchan
1bb2a0961c pthread_cond: refine prvInitializeStaticCond() (#42)
- On v11.1 SMP, pvPortMalloc() should not be called in critical secion.
  vTaskSuspenAll() would trigger assert if in criticalsection.
- The pthread_cond APIs are not ISR safe. Use vTaskSuspendAll() to prevent
  race condition is enough.

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: wangfei_chen <wangfei_chen@realsil.com.cn>
2025-03-31 14:40:19 +05:30
Gaurav Aggarwal
341a8dc6d1 Add a minimal project which builds all the files
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2025-03-10 15:48:35 +00:00
Saiiijchan
b4e74b29fc timer: add missing ";" (#39)
Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: wangfei_chen <wangfei_chen@realsil.com.cn>
2025-03-10 08:43:40 +05:30
Saiiijchan
4930934af3 timer: prevent infinite loop on one-shot timer start (#38)
* timer: prevent infinite loop on one-shot timer start

One-shot timers that expire after a single tick could immediately
transition to a dormant state, despite xTimerCommandSent being pdTRUE.
This situation resulted in a potential deadlock due to an infinite
loop in the timer activation process.

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>

* Code review suggestions

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

---------

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
2025-02-24 21:53:44 +05:30
Saiiijchan
ae1d3f0d5d Remove redundant xTimerStart() in timer_settime (#37)
xTimerChangePeriod() already starts the timer.

Signed-off-by: wangfei_chen <wangfei_chen@realsil.com.cn>
Co-authored-by: wangfei_chen <wangfei_chen@realsil.com.cn>
2025-02-20 16:37:43 -08:00
Gaurav-Aggarwal-AWS
8339845266 Rename xTimerHandle to xTimer (#36)
If configENABLE_BACKWARD_COMPATIBILITY is defined, then xTimerHandle is
defined to TimerHandle_t which would result in conflict.

Fixes #35.

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2025-02-03 22:40:06 +05:30
Ryan Shumate
21d06399f6 pthread_cond: Use Task Notifications (#34)
Update the pthread_cond_t implementation to utilize Task Notifications.
In the existing implementation, if multiple threads of different
priority are blocked on the same condition, a higher priority thread, in
most cases, will unblock multiple times due to taking the underlying
semaphore multiple times instead of just once. Switching to Task
notifications guarantees that all tasks are equally notified and
unblocked.

pthread_cond_signal has also been updated to conform to the POSIX
specification in that it will unblock the highest priority task waiting
on the condition.

Resolves #8
2024-12-31 17:51:13 -08:00
Rohit Madan
e6b133f3b3 Update pthread_cond_timedwait to cope with clock failure (#33) 2024-11-10 17:34:23 +05:30
Gaurav-Aggarwal-AWS
d761d180bd Remove unnecessary NULL check (#31)
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
2024-09-25 16:10:10 +05:30
miguelfreitas
e921c4f791 stm32h745 port using GNU Tools for STM32 (#28) 2023-07-14 12:26:47 -07:00
Muneeb Ahmed
85ce51dad6 Add wait to timer_settime (#17) 2022-02-08 14:57:54 -08:00
João Vitor Teixeira
3b33c3467d Create ptread_detach. (#11)
Create ptread_detach.
2021-12-14 10:12:45 -08:00
Yuhui Zheng
52b1a0f80d Fix "error: #268: declaration may not appear after executable statement in block", when C99 is disabled.
We do have other errors when C99 is disabled, namely the struct initialization and type casting.
I'm not fixing those here, since:
- struct init is consistent within this lib.
- type casting is needed in this design, to hide FreeRTOS symbols.
2020-02-26 11:34:16 -08:00
Yuhui Zheng
fd8dae8a25 Fix "warning: #1-D: last line of file ends without a newline."
And make the end of the file consistent.

Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com>
2020-02-26 11:34:16 -08:00
Yuhui Zheng
eb87d247f9 After this commit, this repository contains only POSIX source code. 2020-02-21 11:58:33 -08:00