gpt4 book ai didi

c# - 在 linux c# 上运行信号量

转载 作者:行者123 更新时间:2023-12-04 14:12:19 28 4
gpt4 key购买 nike

我在 linux 上运行信号量并产生以下错误:

"Exception": {"ClassName": "System.PlatformNotSupportedException", "Message": "The named version of this synchronization primitive is not supported on this platform.", "Data": null, "InnerException": null, "HelpURL ": null," StackTraceString ":" at System.Threading.Semaphore.CreateSemaphoreCore (Int32 initialCount, Int32 maximumCount, String name, Boolean & createdNew) \ n at System.Threading.Semaphore..ctor (Int32 initialCount, Int32 maximumCount, String name, Boolean & createdNew) \ n at System.Threading.Semaphore..ctor (Int32 initialCount, Int32 maximumCount, String name) \ n "," RemoteStackTraceString ": null," RemoteStackIndex ": 0," ExceptionMethod ": null," HResult ": - 2146233031," Source ":" System.Private.CoreLib "," WatsonBuckets ": null},

有人可以帮助我吗?

最佳答案

Linux 不支持命名同步原语,因此 .NET Core 也不支持。

https://github.com/dotnet/runtime/issues/5211

更新基于评论

从 .NET 5 开始,命名信号量仍不受支持。我没有测试过其他原语。

NET 6 更新

仍然不支持命名信号量,但命名互斥量至少在 MacOS 上可以正常工作

enter image description here

关于c# - 在 linux c# 上运行信号量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63290287/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com