forked from skylersaleh/SkyEmu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Achievements]Thread safety improvements
- Loading branch information
Showing
5 changed files
with
67 additions
and
28 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extern "C" { | ||
#include "recursive_mutex.h" | ||
} | ||
#include <mutex> | ||
|
||
recursive_mutex_t create_mutex() { | ||
recursive_mutex_t mutex = new std::recursive_mutex; | ||
return mutex; | ||
} | ||
|
||
void destroy_mutex(recursive_mutex_t mutex) { | ||
delete (std::recursive_mutex*)mutex; | ||
} | ||
|
||
void lock_mutex(recursive_mutex_t mutex) { | ||
((std::recursive_mutex*)mutex)->lock(); | ||
} | ||
|
||
void unlock_mutex(recursive_mutex_t mutex) { | ||
((std::recursive_mutex*)mutex)->unlock(); | ||
} |
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,8 @@ | ||
#ifndef RECURSIVE_MUTEX_WRAPPER | ||
#define RECURSIVE_MUTEX_WRAPPER | ||
typedef void* recursive_mutex_t; | ||
recursive_mutex_t create_mutex(); | ||
void destroy_mutex(recursive_mutex_t mutex); | ||
void lock_mutex(recursive_mutex_t mutex); | ||
void unlock_mutex(recursive_mutex_t mutex); | ||
#endif |
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