How do I specify the equivalent of volatile in VB.net?
问题 I'm attempting to write a lock-free version of a call queue I use for message passing. This is not for anything serious, just to learn about threading. I'm relatively sure my code is correct, except if the instructions are re-ordered or done in registers. I know I can use memory barriers to stop re-ordering, but how can I ensure values are written to memory immediately? Public Class CallQueue Private first As New Node(Nothing) 'owned by consumer' Private last As Node = first 'owned by