-
-
Notifications
You must be signed in to change notification settings - Fork 878
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
video_core: Use adaptive mutex on Linux
Fix performance regression with #1973 on SteamDeck
- Loading branch information
1 parent
562ed2a
commit 6180c9a
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
|
||
#pragma once | ||
|
||
#ifdef __linux__ | ||
#include <pthread.h> | ||
#endif | ||
|
||
namespace Common { | ||
|
||
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP | ||
class AdaptiveMutex { | ||
public: | ||
void lock() { | ||
pthread_mutex_lock(&mutex); | ||
} | ||
void unlock() { | ||
pthread_mutex_unlock(&mutex); | ||
} | ||
|
||
private: | ||
pthread_mutex_t mutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP; | ||
}; | ||
#endif // PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP | ||
|
||
} // namespace Common |
This file contains 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
This file contains 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