Skip to content

WIP: Add non-recursive thread lock support for Windows ##util - #26302

Open
randomjack94dev wants to merge 1 commit into
radareorg:masterfrom
randomjack94dev:util/thread-lock-non-recursive-win
Open

WIP: Add non-recursive thread lock support for Windows ##util#26302
randomjack94dev wants to merge 1 commit into
radareorg:masterfrom
randomjack94dev:util/thread-lock-non-recursive-win

Conversation

@randomjack94dev

@randomjack94dev randomjack94dev commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
  • Mark this if you consider it ready to merge
  • I've added tests (optional)
  • I wrote some lines in the book (optional)

Description

Use SRWLocks to handle non-recursive thread locks on Windows (as suggested by the TODO comment). We use a union of CRITICAL_SECTION and SRWLOCK tagged by 'recursive' boolean flag to cover both types of locks.

@trufae
trufae force-pushed the master branch 2 times, most recently from b95a936 to ad1ca1a Compare July 20, 2026 17:05
Use SRWLocks to handle non-recursive thread locks on Windows
@randomjack94dev
randomjack94dev force-pushed the util/thread-lock-non-recursive-win branch from 4ad0401 to f7d21a7 Compare July 26, 2026 09:23
@randomjack94dev
randomjack94dev marked this pull request as ready for review July 26, 2026 09:49
@randomjack94dev

Copy link
Copy Markdown
Contributor Author

@trufae

It doesn't seem to me like it's going to break something, but I am not entirely sure and you certainly have more experience in this regard than me. Any thoughts?

I don't think I fully understand the purpose of r_w32 wrappers (targeting older versions of Windows?), so I have a question about those. As you can see, I added r_w32_SleepConditionVariableSRW in analogy with r_w32_SleepConditionVariableCS, but haven't done so for other SRWLock functions (as CS-functions which were already used for implementing locks are called without wrappers). But since SRW-locks require Vista/2008 CI w64-mingw build yields warnings about their implicit declaration. Should I also add r_w32 wrappers for SRWLock functions used in util/thread_lock.c?

Any feedback is appreciated, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant