Dynamic Code in D

Sean Kelly sean at f4.ca
Mon Jan 14 08:24:56 PST 2008


Neal Alexander wrote:
>>> Otherwise, I could just implement my own synchronization, via inline 
>>> assembly (since this doesn't have to be multi-platform) or C.<
>>
>> You are a bold person :-)
> 
> I was under the impression this was easy using XADD / CMPXCHG with the 
> LOCK prefix.

It's also very slow compared to some of the optimized algorithms out 
there.  But putting inline asm inside functions is pretty easy either way.

> How to yield / wait may be a different story, but how many possible 
> general purpose options could there be?

There are established, optimized algorithms for locking on x86, so 
implementing one by example shouldn't be difficult.  I don't have any 
links offhand though.  comp.programming.threads would be a good start.


Sean



More information about the Digitalmars-d mailing list