8 Commits

Author SHA1 Message Date
Guillaume Souchere
445db75612 fix(linux): implement pthread-based locks for soft-preemption safety
The Linux target's sys/lock.h provided no-op inline stubs, which was
safe only under the assumption of single-threaded execution.  With the
new FreeRTOS Linux simulator using soft preemption, an outgoing task
can still run concurrently with the incoming task until it reaches a
yield point, making no-op locks unsafe.

Replace the no-op implementation with real pthread mutexes:

- Change _lock_t from `typedef int` to `typedef void *` (pointer to a
  heap-allocated pthread_mutex_t).
- Implement all _lock_* functions in a new lock.c, supporting both
  normal and recursive mutexes.
- Zero-initialized locks are lazily created on first acquire using
  double-checked locking, preserving newlib/esp_libc semantics.
- Add lock.c unconditionally to the linux component sources and link
  pthread.
2026-06-04 11:36:34 +02:00
Jakob Hasse
2f0ef33f9d fix(linux): fixed build errors on MacOS 2024-05-06 11:14:05 +02:00
Marius Vikhammer
77dcb6d46e refactor(system): reformated esp_timer, linux and log comp with astyle 2024-02-04 14:50:54 +08:00
Darian Leung
f50d83413e refactor(tools): Tidy up core component files copyright ignore
Some files that should have their copyrights checked are still placed on the
copyright ignore list.

- These entries have been tidied up
- Copyrights of those files have been updated.
2024-01-22 18:07:35 +08:00
Ivan Grokhotkov
7b8f69404f feat(linux): provide getrandom implementation for macOS
This makes getrandom(2) usable when compiling with IDF_TARGET=linux
on a macOS host.
2023-12-19 15:11:32 +01:00
Ivan Grokhotkov
f72ce6720d linux: add dummy sys/lock.h implementation (single threaded only)
Useful for building IDF code which relies on the legacy locking
functions from newlib.
2022-01-24 18:51:40 +01:00
Ivan Grokhotkov
e7e059cc0a linux: allow "sys/queue.h" to be used on macOS
macOS and other BSD-like systems have <sys/queue.h> header. Fall back
to it if bsd/sys/queue.h (provided on Linux by libbsd) is not found.
2022-01-24 18:51:40 +01:00
Jakob Hasse
c9984faaef [mocks]: freertos mock
[esp_event]: added preliminary host-based tests
2021-08-06 17:08:21 +08:00