From 7029747ab50fbd421114eb40f1a9a37e41ae1708 Mon Sep 17 00:00:00 2001 From: Gammasoft Date: Thu, 9 Jan 2025 23:13:41 +0100 Subject: [PATCH 1/2] Review thread on linux --- src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp b/src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp index 8513e9a01dbd..1c78b2f6db49 100644 --- a/src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp +++ b/src/xtd.core.native.linux/src/xtd/native/linux/thread.cpp @@ -22,9 +22,10 @@ intmax_t thread::create(std::function start, intmax_t obj, int32 start_obj->first(start_obj->second); delete start_obj; return nullptr; - }, reinterpret_cast( new std::pair, intmax_t> {start, obj})); + }, reinterpret_cast(new auto(std::make_pair(start, obj)))); if (error != 0) return static_cast(PTHREAD_FAILED); - // The POSIX standard provides no mechanism by which a thread A can suspend the execution of another thread B, without cooperation from B. The only way to implement a suspend/resume mechanism is to have B check periodically some global variable for a suspend request and then suspend itself on a condition variable, which another thread can signal later to restart B. + // POSIX does not support suspending a thread without its cooperation. + // A thread must periodically check a global variable and suspend itself on a condition variable. id = static_cast(thread); return static_cast(thread); } From d8fcbfdfb349f00280b05754d627c719d65d6b5f Mon Sep 17 00:00:00 2001 From: Gammasoft Date: Thu, 9 Jan 2025 23:18:00 +0100 Subject: [PATCH 2/2] Review thread on linux --- src/xtd.core.native.linux/include/xtd/core_native_export.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xtd.core.native.linux/include/xtd/core_native_export.hpp b/src/xtd.core.native.linux/include/xtd/core_native_export.hpp index 0a48937c0c73..f9096b6e2725 100644 --- a/src/xtd.core.native.linux/include/xtd/core_native_export.hpp +++ b/src/xtd.core.native.linux/include/xtd/core_native_export.hpp @@ -4,7 +4,7 @@ /// @file /// @brief Contains #core_native_export_ keyword. -/// @copyright Copyright (c) 2024 Gammasoft. All rights reserved. +/// @copyright Copyright (c) 2025 Gammasoft. All rights reserved. #pragma once /// @brief Define shared library export.