Idea for Threads

Sean Kelly sean at f4.ca
Mon May 14 12:37:17 PDT 2007


Craig Black wrote:
>> One of the problems is memory corruption because reading is done when a 
>> write is in progress. > This can be avoided by the use of mutexes.
> 
> I was thinking about this.  An efficient mutex implementation should take 
> into consideration read and write access.  If there is a write, then all 
> access to the data should be prohibited until the write is completed. 
> However, any number of reads should be able to work together in parallel. 
> If a read is treaded the same as a write, then that would be very 
> inefficient.
> 
> I don't know a lot about the details of mutexes.  Do they multiple reads 
> simultaneously?

ReadWrite mutexes do, but they're a bit more complicated than your 
average mutex.


Sean



More information about the Digitalmars-d mailing list