mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
Revert "JBR-6522: ensure thread-safety in MTLGC_DestroyMTLGraphicsConfig (pthread_mutex_t)"
This reverts commite7e3638c52. (cherry picked from commita2ee33a45a)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -29,8 +29,6 @@
|
||||
#import "ThreadUtilities.h"
|
||||
#import "awt.h"
|
||||
|
||||
static pthread_mutex_t destroy_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Disposes all memory and resources associated with the given
|
||||
* MTLGraphicsConfigInfo (including its native MTLContext data).
|
||||
@@ -48,16 +46,10 @@ MTLGC_DestroyMTLGraphicsConfig(jlong pConfigInfo)
|
||||
return;
|
||||
}
|
||||
|
||||
if (mtlinfo->context != NULL) {
|
||||
// Ensure thread-safe free:
|
||||
pthread_mutex_lock(&destroy_mutex);
|
||||
|
||||
const MTLContext *mtlc = (MTLContext*)mtlinfo->context;
|
||||
if (mtlc != NULL) {
|
||||
mtlinfo->context = nil;
|
||||
[mtlc release];
|
||||
}
|
||||
pthread_mutex_unlock(&destroy_mutex);
|
||||
MTLContext *mtlc = (MTLContext*)mtlinfo->context;
|
||||
if (mtlc != NULL) {
|
||||
[mtlinfo->context release];
|
||||
mtlinfo->context = nil;
|
||||
}
|
||||
free(mtlinfo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user