Begin to use std::mutex in place of ArchMutex - #8674
Merged
Conversation
sithlord48
force-pushed
the
barrier410
branch
2 times, most recently
from
June 10, 2025 23:59
4db2217 to
a3f4666
Compare
sithlord48
marked this pull request as ready for review
June 11, 2025 01:51
sithlord48
force-pushed
the
barrier410
branch
2 times, most recently
from
June 12, 2025 03:27
9402090 to
ef8815a
Compare
port debauchee@b0e415d build: link base to arch
nbolton
force-pushed
the
barrier410
branch
2 times, most recently
from
June 14, 2025 08:09
e6d48c9 to
bdc2645
Compare
nbolton
approved these changes
Jun 14, 2025
nbolton
enabled auto-merge (rebase)
June 14, 2025 08:29
nbolton
disabled auto-merge
June 14, 2025 08:37
jwakely
reviewed
Sep 4, 2025
| #include <mutex> | ||
|
|
||
| static ArchMutex s_mutex = nullptr; | ||
| std::mutex s_mutex; |
Contributor
There was a problem hiding this comment.
Should this still be static, or in an anonymous namespace? It doesn't need to be globally visible (and possibly clash with an s_mutex in other translation units)
Comment on lines
+602
to
+605
| { | ||
| std::lock_guard<std::mutex> lock(m_mutex); | ||
| inet_ntop(AF_INET6, &ipAddr->sin6_addr, strAddr, INET6_ADDRSTRLEN); | ||
| } |
Contributor
There was a problem hiding this comment.
I assume the purpose of the extra braces is so that the mutex is unlocked before constructing the std::string return value from the array strAddr? In that case, why is the kINIT case above different? That one constructs the string s (and move constructs it into the return value) while the mutex is held.
Member
Author
There was a problem hiding this comment.
Honestly not sure this was ported from downstream i would think they should both have braces.
Step 1 was to Port, Now we can improve it feel free to propose a PR
jwakely
added a commit
to jwakely/deskflow
that referenced
this pull request
Sep 4, 2025
The `static` keyword was removed by deskflow#8674 but I think it should be restored so that this global can't clash with anything else called `::s_mutex` elsewhere in the executable.
jwakely
added a commit
to jwakely/deskflow
that referenced
this pull request
Sep 4, 2025
The `static` keyword was removed by deskflow#8674 but I think it should be restored so that this global can't clash with anything else called `::s_mutex` elsewhere in the executable.
nbolton
pushed a commit
that referenced
this pull request
Sep 4, 2025
The `static` keyword was removed by #8674 but I think it should be restored so that this global can't clash with anything else called `::s_mutex` elsewhere in the executable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Begin to replace
ArchMutexwithstd::mutex. In this first step all cases ofArchMutexorMutexthat were not part of a conditional var have been replaced.Tested locally for a few days didn't see any issues.
Backport from debauchee#410:
std::mutexinarch/unix/ArchMutithreadPosixstd::mutexinarch/ArchStringsstd::mutexinbase/Logstd::mutexinbase/EventQueueAdditionally:
std::mutexinarch/win32/ArchMultiThreadWindowsstd::mutexinarch/unix/ArchNetworkBSDstd::mutexinarch/unix/ArchNetworkWinSockstd::mutexindeskflow/PacketStreamFilterstd::mutexinnet/TCPListenSocketstd::mutexinplatform/XWindowsEventQueue