How to use x64 lock operations with MemoryMappedFiles in .net

I need to use Interlocked Operations (CompareExchange, Increment, etc.) for memory in a MemoryMappedFile in .NET.

I found this answer to a very similar question. The problem is that blocked operations are not exported from dll32 (or any other) to a 64-bit OS (see, for example, http://blog.kalmbachnet.de/?postid=46 ).

Is there any other way how I can call blocked functions on a memory block in a 64-bit .NET process?

+7
multithreading c # memory-mapped-files interlocked
source share
1 answer

Write yourself a small C ++ / CLI helper library that provides the blocked operations available by managed code.

I believe that the fastest way to interact will be to open a managed class that internally calls an unmanaged function that itself uses built-in functions. This way, you don’t even need to go through PInvoke.

+1
source share

All Articles