Non movable structs

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 18 19:06:59 PDT 2016


Well all is in the title. Is there a way to achieve this ? If 
not, would this be possible to make this happen ?

Background: I'm working on synchronization primitives for SDC's 
runtime. All the cool kids synchronization primitives rely on the 
mutex's address to do various things.

Making the mutex a class is out of the question, especially since 
They'll be used in the GC, so that would create a dependency loop 
I don't want to get into. System mutexes are good as a fallback, 
but they aren't lightweight - also, they require 32/64 bits 
instead of being able to be flags -, so you'd want to hit them 
only in the slow path.

Long story short, I need structs that do not move. I'm sure there 
are many other use cases.


More information about the Digitalmars-d mailing list