2
A
回答
3
您需要查看System.Threading
命名空間中的Interlocked類。 CompareExchange
是你正在尋找的方法。
它的格式爲CompareExchange(target, value, comparand)
,其中僞代碼表示if(target==comparand) target=value;
。
Interlocked
類中還有其他一些有用的原子方法,例如Increment,Decrement,Add和Exchange。
3
您可能正在尋找Interlocked.CompareExchange
。
相關問題
- 1. 在一個系列上設置操作
- 2. 設置一個if else語句來檢查查詢字符串
- 3. 設置變量作爲操作存儲操作或值嗎?
- 4. 設置多個操作
- 5. Clojure有一個類似於Haskell's Dollar Symbol的操作符嗎?
- 6. 操作設置
- 7. 如何檢查字符串中某個位置的字符.net
- 8. Maude-system可以有一個操作有兩個以上的操作數嗎?
- 9. 我們可以在smooks中進行字符串操作和條件檢查嗎?
- 10. android:檢查爲intent.ACTION_SEND配置的操作?
- 11. .net操作符超載
- 12. 檢查定製nill平等==操作符
- 13. 檢查索引操作符存在
- 14. C#操作符==檢查爲空
- 15. 設置2個字符作爲一個
- 16. 拖動單選按鈕執行操作但未設置檢查
- 17. 是NamedParameterJdbcTemplate設置PARAMS用或操作者與檢查空
- 18. 爲所有成員路由設置一個before操作?
- 19. 具有NAND操作和非操作的多個查詢的Mysql
- 20. 如何找到一個字符串操作數和操作
- 21. 豬查詢設置操作AB
- 22. 設置一個值並檢查null是否不起作用
- 23. 在Mongo中做任何檢查和設置類似原子操作的方法?
- 24. 在CSS定義中設置操作的順序有關係嗎?
- 25. 檢查是否設置了一個設置
- 26. C#=>操作符有什麼作用? (BESIDES是一個lambda操作符)
- 27. 如何找到與使用子查詢相同的操作和設置操作
- 28. 字符串操作從一個檢索兩串字符串
- 29. Java和.Net互操作性
- 30. 如何設置只有一個單選按鈕可以檢查
不知道檢查和設置是什麼,但看看「互鎖」類。它有比較和交換以及類似的操作。 – CodesInChaos