summaryrefslogtreecommitdiff
path: root/tests/meson.build
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-15 12:37:10 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-15 12:37:10 +0300
commite3d8fe4854a7ef7ff0637688cda9e65feb680122 (patch)
tree56bc226a49b7a706e078923434cb9fb05bab6e21 /tests/meson.build
parent5f03033b0e211f9ed13e7a1351f9a8f9011ab665 (diff)
Replace the writer spin lock with a blocking mutex
term_write_begin spun on an atomic sequence word. A waiter burned CPU, and with no priority inheritance a SCHED_FIFO waiter could starve a preempted holder on the same CPU. The writer section is now a pthread mutex with PTHREAD_PRIO_INHERIT where the platform has it, and an SRWLOCK on Windows. Re-entry on the owning thread still only counts the depth. The platform wrapper (init, lock, unlock, destroy) is in compat.h. term_new initializes the mutex, and term_free destroys it. Meson links the thread library into the core, term_dep, and term_internal_dep. The README, term.h, and the amalgamation note say that POSIX needs -pthread. Tests: the feed and snapshot thread test now checks the final screen and history against a serial reference. A new test checks that term_lock nests and that another thread waits for the last term_unlock. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/meson.build')
-rw-r--r--tests/meson.build4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/meson.build b/tests/meson.build
index 69f3c49..358df70 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -76,7 +76,7 @@ term_amalgamation = custom_target(
term_amalgamation_lib = static_library(
'term-amalgamation',
term_amalgamation[0],
- dependencies: [m_dep],
+ dependencies: [m_dep, thread_dep],
override_options: ['c_std=c11', 'warning_level=3', 'werror=true'],
build_by_default: false,
)
@@ -89,7 +89,7 @@ foreach entry : term_tests
c_args: test_c_args,
include_directories: [term_inc, test_helpers_inc],
link_with: term_amalgamation_lib,
- dependencies: [m_dep] + entry[2],
+ dependencies: [m_dep, thread_dep] + entry[2],
build_by_default: false),
env: test_env, suite: ['unit', 'amalgamation'], timeout: 180)
endif