walnux/sched
Ville Juven bb85ad849e pthread_cond_wait: Use atomic_t to protect the waiter count
The load/compare and RMW to wait_count need protection. Using atomic
operations should resolve both issues.

NOTE:
The assumption that the user will call pthread_cond_signal /
pthread_cond_broadcast with the mutex given to pthread_cond_wait held is
simply not true. It MAY hold it, but it is not forced. Thus, using the
user space lock for protecting the wait counter as well is not valid!

The pthread_cond_signal() or pthread_cond_broadcast() functions may be called by a thread whether or not it currently owns the mutex that threads calling pthread_cond_wait() or pthread_cond_timedwait() have associated with the condition variable during their waits; however, if predictable scheduling behaviour is required, then that mutex is locked by the thread calling pthread_cond_signal() or pthread_cond_broadcast().

[1] https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cond_signal.html
2025-01-20 23:55:26 +08:00
..
addrenv sem_waitirq: Use kmap interface to access the semaphore 2024-12-18 08:57:01 +08:00
clock sched/clock: remove unlock logic to avoid relock 2025-01-13 19:11:49 -03:00
environ sched/environ: There is no need to use sched_[un]lock 2024-10-11 02:43:11 +08:00
event sched/event: init deleted node to avoid null pointer reference 2024-12-26 23:28:37 +08:00
group group: use tg_mutex to replace tg_joinlock 2025-01-19 17:08:32 +08:00
init pthread: remove enter_critical_section in pthread_mutex 2025-01-12 22:30:35 +08:00
instrument gprof: move gprof function from sched to libbuiltin/libgcc 2024-11-13 02:42:31 +08:00
irq irq: enter_critical_section_wo_note/leave_critical_section_wo_note 2025-01-14 12:29:29 +08:00
misc coredump: fix crash dump failed when items of pr_regs not equal with regs_num 2025-01-19 19:43:53 +08:00
module modlib:Standardized module loading method 2024-10-05 15:22:02 +08:00
mqueue sched/mqueue/CMakeLists.txt: fix compilation for CONFIG_DISABLE_MQUEUE_SYSV=n 2025-01-17 23:14:39 +08:00
paging Remove duplicate includes across multiple files 2025-01-09 23:30:23 +08:00
pthread pthread_cond_wait: Use atomic_t to protect the waiter count 2025-01-20 23:55:26 +08:00
sched sched_processtimer: use atomic to protect g_timer_interval and g_timer_tick 2025-01-14 00:27:13 +08:00
semaphore sched/semaphore: tick wait 0 timeout should be safe in interrupt context 2024-12-30 12:02:34 +08:00
signal sched: remove all spin_lock_irqsave(NULL) 2025-01-06 23:11:44 +08:00
task pthread: remove enter_critical_section in pthread_mutex 2025-01-12 22:30:35 +08:00
timer sched/timer: remove critical section in setitimer 2025-01-19 17:08:32 +08:00
tls sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
wdog sched/wdog: remove wd_cancel_irq() implement 2025-01-17 09:05:11 +08:00
wqueue sched/wqueue: some minor improve to reduce sched_lock range 2025-01-17 23:33:23 +08:00
CMakeLists.txt sched: migrate to SPDX identifier 2024-09-12 01:10:14 +08:00
Kconfig libc/unistd: move NAME_MAX/LINE_MAX/PATH_MAX define to unistd 2025-01-15 23:17:51 +08:00
Makefile Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00