Threads don't scale, processes do - Fibers

Sean Kelly sean at invisibleduck.org
Sat Aug 30 09:02:15 PDT 2008


Oliver Dathe wrote:
>> This sounds synergistic with thin-locks. Although locking code would 
>> have to be moved into the thread class to allow polymorphism on how 
>> the lock's aquired. i.e. Thead.getThis.lock(heavy_lock)
> 
> Polymorphism is already used for that. You could modify __monitor (or 
> (cast(void*)this)[1]) in an object to show to a struct with an interface 
> reference for lock() and unlock(). You can then synchronize(...) on 
> that, so I don't think you have to touch Thread for that. That is what 
> I've seen in tango.core.sync.Monitor.

Yup.  I'd even be happy to add a setMonitor routine somewhere, but as 
it's one line of code anyway I didn't see the need.


Sean



More information about the Digitalmars-d mailing list