mirror of
https://github.com/lief-project/LIEF
synced 2026-06-08 15:30:44 +00:00
Update
This commit is contained in:
+3
-2
@@ -128,7 +128,7 @@ if(NOT LIEF_OPT_MBEDTLS_EXTERNAL)
|
||||
)
|
||||
if (LIEF_PYTHON_FREE_THREADED)
|
||||
target_compile_definitions(LIB_LIEF PRIVATE
|
||||
# These '#define' have an impact at compile time.
|
||||
# these must be set at LIB_LIEF compile time to be forwarded to MbedTLS
|
||||
-DMBEDTLS_THREADING_C
|
||||
-DMBEDTLS_THREADING_ALT
|
||||
)
|
||||
@@ -142,7 +142,8 @@ else()
|
||||
target_link_libraries(LIB_LIEF PRIVATE
|
||||
MbedTLS::tfpsacrypto MbedTLS::mbedx509)
|
||||
if (LIEF_PYTHON_FREE_THREADED)
|
||||
message(WARNING "Python free-threaded needs MbedTLS with threading support")
|
||||
message(WARNING "Python free-threading requires the external MbedTLS to have \
|
||||
been built with threading support. LIEF cannot enforce this.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ void init(nb::module_& m) {
|
||||
m.attr("__is_tagged__") = bool(LIEF_TAGGED);
|
||||
m.doc() = "LIEF Python API";
|
||||
|
||||
// This attribute defines whether LIEF was compiled without GIL
|
||||
// This attribute reflects whether LIEF was compiled with free-threading support
|
||||
#if defined (NB_FREE_THREADED)
|
||||
m.attr("__free_threaded__") = true;
|
||||
#else
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
|
||||
* Python 3.8 is no longer supported
|
||||
* Add support for the free-threaded Python builds.
|
||||
The C++ core is thread safe on the few static variables,
|
||||
The C++ core is now thread-safe with respect to its few static variables,
|
||||
and can be used when the GIL is disabled (:issue:`1255`):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -414,8 +414,8 @@ void ResourcesManager::change_icon(const ResourceIcon& original,
|
||||
}
|
||||
|
||||
ResourcesManager::it_const_dialogs ResourcesManager::dialogs() const {
|
||||
static std::mutex DIAG_MU;
|
||||
std::scoped_lock lock(DIAG_MU);
|
||||
static std::mutex DIALOG_CACHE_MU;
|
||||
std::scoped_lock lock(DIALOG_CACHE_MU);
|
||||
dialogs_.clear();
|
||||
const ResourceNode* dialog_node = get_node_type(TYPE::DIALOG);
|
||||
if (dialog_node == nullptr) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace LIEF {
|
||||
void mbedtls_init() {
|
||||
static std::once_flag ONCE;
|
||||
std::call_once(ONCE, [] {
|
||||
@@ -39,3 +40,4 @@ void mbedtls_init() {
|
||||
std::atexit(mbedtls_psa_crypto_free);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace LIEF {
|
||||
void mbedtls_init();
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <cassert>
|
||||
#include <mbedtls/threading.h>
|
||||
|
||||
inline auto* get_mu(mbedtls_platform_mutex_t* mu) {
|
||||
|
||||
+1
-1
@@ -470,5 +470,5 @@ def convert_size(size_bytes: int) -> str:
|
||||
|
||||
|
||||
def is_free_threaded() -> bool:
|
||||
"Check if the current interpreter supports free-threading"
|
||||
"""Check if the current interpreter supports free-threading"""
|
||||
return sysconfig.get_config_var("Py_GIL_DISABLED") == "1" and lief.__free_threaded__
|
||||
|
||||
Reference in New Issue
Block a user