Revert "JBR-6522: ensure thread-safety in MTLGC_DestroyMTLGraphicsConfig (pthread_mutex_t)"

This reverts commit e7e3638c52.

(cherry picked from commit a2ee33a45a)
This commit is contained in:
bourgesl
2024-02-09 13:28:34 +01:00
committed by jbrbot
parent 95a981b82e
commit 40f81af80d

View File

@@ -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);
}