我使用併發隊列,並通過創建Action委託併發隊列離隊
Action action =() =>
{
SubscriptionResponseModel subsModel;
while (concurrentQueue.TryTake(out subsModel))
{
MakeTransactionAndAddIntoQueue(subsModel);
}
};
出列,通過多線程隊列中的數據,並調用這個動作代表並行多線程
Parallel.Invoke(action, action, action, action, action, action, action, action, action, action, action, action, action, action, action);
我想知道有一件事,當我在多個動作中使用SubscriptionResponseModel subsModel;
時它是線程安全的嗎?
什麼是SubscriptionResponseModel – Trey
這取決於*您*執行'SubscriptionResponseModel' –