【发布时间】:2020-11-27 02:41:12
【问题描述】:
我在 linux 上运行信号量并产生以下错误:
“Exception”:{“ClassName”:“System.PlatformNotSupportedException”,“Message”:“此平台不支持此同步原语的命名版本。”,“Data”:null,“InnerException”:null , "HelpURL": null," StackTraceString ":" 在 System.Threading.Semaphore.CreateSemaphoreCore (Int32 initialCount, Int32 maximumCount, String name, Boolean & createdNew) \n 在 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},
有人可以帮我吗?
【问题讨论】:
-
你真的需要一个有名字的吗?
-
我需要它,因为它会根据特定的令牌锁定。示例:1 - abcd123 - 运行 2 - abcd123 - 锁定 3 - 7895aa - 运行
-
您可以将信号量存储在全局
ConcurrentDictionary<string, SemaphoreSlim>,键是名称。