sem_acquire has no reason to do a notify! #857
No reviewers
Labels
No labels
bazel
bluetooth
board settings
boot_stage2
bug
build
c++
can't reproduce
clang
clib-interface
cmsis
code cleanliness
code size
compiler version issues
cyw43_driver
debug
discussion
documentation
duplicate
dynamic_clock
elf2uf2
enhancement
errata
filesystem
flash layout
floating point
FreeRTOS
hardware_adc
hardware_claim
hardware_clocks
hardware_dma
hardware_exception
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_rcp
hardware_rtc
hardware_spi
hardware_sync
hardware_uart
hardware_vreg
hardware_watchdog
hardware_xosc
help wanted
host
IAR
installation
invalid
linker scripts
lto
lwip
mbedtls
missing API
needs reporter detail
networking
newlib
newlib-multicore
non-c
non-cmake
non-gcc
openocd
orphan PR
OS integration
pico_async_context
pico_base
pico_binary_info
pico_flash
picolibc
pico_lwip
pico_malloc
pico_multicore
pico_printf
pico_runtime
pico_stdio
pico_stdio_usb
pico_sync
pico_time
pico_util
pioasm
port
question
review
review2
rtos interop
runtime init
static library
svd
test
tinyusb
vscode
wifi integration
wontfix
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-raspberrypi/pico-sdk!857
Loading…
Reference in a new issue
No description provided.
Delete branch "sem_acquire_fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The source for
sem_release()has this todo comment:If there is ever a
sem_release_blocking(), then the acquires will need the notifications. If the todo is ever to come true, maybe 1.3.2 is the time for it?sem_release_blocking()would probably want to have the variations on the theme that the acquires have -- timeouts, until and try.Or maybe delete the todo, and not have
sem_release_blocking()? I personally have never needed that, and don't know of algorithms that require it. But I certainly don't know all of the ways semaphores are used. The caller ofsem_release()can check its return value, FWIW.By comparison, POSIX semaphores don't configure a maximum value the way the SDK sets
max_permits(SEM_VALUE_MAXis a resource constraint, since the counter can only go so high). As a consequence, the POSIX API doesn't foresee blocking, timeout or try variants forsem_post(). On Linux,sem_post()returns an error if the count exceedsSEM_VALUE_MAX, but POSIX apparently doesn't require that.Which tends to persuade me that
sem_release_blocking()is not needed, the todo can be deleted, and this comment may have been much ado about nothing. In which case apologies, but I think I'll hit the submit button anyway, because it seems to be worth thinking through,Yup; agreed sem_release_blocking would require the additional of new notifications/waits however these changes would remain the same (I think)