aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/libgccjit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/jit/libgccjit.cc')
-rw-r--r--gcc/jit/libgccjit.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/gcc/jit/libgccjit.cc b/gcc/jit/libgccjit.cc
index ca86266..8884128 100644
--- a/gcc/jit/libgccjit.cc
+++ b/gcc/jit/libgccjit.cc
@@ -19,7 +19,7 @@ along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
-#define INCLUDE_PTHREAD_H
+#define INCLUDE_MUTEX
#include "system.h"
#include "coretypes.h"
#include "timevar.h"
@@ -4060,7 +4060,7 @@ gcc_jit_context_new_rvalue_from_vector (gcc_jit_context *ctxt,
Ideally this would be within parse_basever, but the mutex is only needed
by libgccjit. */
-static pthread_mutex_t version_mutex = PTHREAD_MUTEX_INITIALIZER;
+static std::mutex version_mutex;
struct jit_version_info
{
@@ -4068,9 +4068,8 @@ struct jit_version_info
guarded by version_mutex. */
jit_version_info ()
{
- pthread_mutex_lock (&version_mutex);
+ std::lock_guard<std::mutex> g (version_mutex);
parse_basever (&major, &minor, &patchlevel);
- pthread_mutex_unlock (&version_mutex);
}
int major;