dave-hillier / disruptor-unity3d

Basic implementation of Disruptor for Unity3d
Apache License 2.0
200 stars 35 forks source link

WSA build #3

Closed foriero closed 8 years ago

foriero commented 8 years ago

Hi, in wsa build we face that MemoryBuffer() and SpinWait() do not exists. Any idea how to rewrite the code so that it works also in WSA builds?

dave-hillier commented 8 years ago

Can you provide steps to reproduce this?

dave-hillier commented 8 years ago

It looks like here are the recommended changes:

https://msdn.microsoft.com/en-gb/library/br230302.aspx#threading

foriero commented 8 years ago

Hi, for the MemoryBarier it was easy. Instead of Thread.MemoryBarier() it is Interlocked.MemoryBarier().

But not sure what to put there instead SpinWait. This one is a bit more tricky. Can you help with that?

dave-hillier commented 8 years ago

SpinWait can safely be replaced with Thread.Sleep(0); or Thread.Yield() - although it will change the performance characteristics (although you might never be able to tell)