Re: D locking strategies

2013-03-17 Thread estew
Thanks for the reply. I have opIndex, opSlice et. al. implemented now but I was a bit stuck on the thread-safety issue and wanted to resolve that first. On Friday, 15 March 2013 at 13:39:32 UTC, Andrea Fontana wrote: On Friday, 15 March 2013 at 02:20:01 UTC, estew wrote: Ok, I did a bit mo

Re: D locking strategies

2013-03-15 Thread Andrea Fontana
On Friday, 15 March 2013 at 02:20:01 UTC, estew wrote: Ok, I did a bit more reading of TDPL and decided to go with the following pattern: synchronized class A{ private string[] _values; void setValue(size_t i, string val) {_values[i] = val;} string getValue(size_t i) const {ret

Re: D locking strategies

2013-03-14 Thread estew
Ok, I did a bit more reading of TDPL and decided to go with the following pattern: synchronized class A{ private string[] _values; void setValue(size_t i, string val) {_values[i] = val;} string getValue(size_t i) const {return _values[i];} } Works fine, my problem solved :) Ag

D locking strategies

2013-03-14 Thread estew
Hi All, I'm getting myself confused with thread-safety and locking. I have a class something like the following small example: class A{ private string[] _values; void setValue(size_t i, string val) {_values[i] = val;} string getValue(size_t i) conts {return _values[i];} const(