Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Eliminate Interlocked CompareExchange #1

@ncruces

Description

@ncruces

Hi,

I've found what I think is a "simpler" and more "general" solution for the ExecutionEngineException on events compiled with Visual Studio.

You can simply replace any call to the generic version of CompareExchange:
call !!0 [mscorlib]System.Threading.Interlocked::CompareExchange(!!0&, !!0, !!0)

With a call to the non-generic version:
call object [mscorlib]System.Threading.Interlocked::CompareExchange(object&, object, object)

You can safely do the same for calls to Interlocked::Exchange. You'll maintain thread-safety, and (surprisingly) it works on all platforms (at least for trusted code).

Greatings.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions