C
Curtis Hatter
Hi,
Hope this question makes sense. =)
I have an object, and a wrapper for that object that implements a
synchronized view (similar to getting a synchronized ArrayList).
What I'm wondering is, if I need to lock all methods? Here's an example:
I have 3 versions of an IndexOf method:
public override void IndexOf(object value) {
return IndexOf(object value, 0)
}
public override void IndexOf(object value, int startIndex) {
return IndexOf(object value, 0, __innerObject.__count);
}
public override void IndexOf(object value, int startIndex, int count) {
lock (__innerObject) {
return (__innerObject.IndexOf(value, startIndex, count);
}
}
is it possible, if i don't lock all the IndexOf methods, that i could get
unexpected results? Or will I be fine since I end up calling a method that
is locked?
Thanks,
Curtis
Hope this question makes sense. =)
I have an object, and a wrapper for that object that implements a
synchronized view (similar to getting a synchronized ArrayList).
What I'm wondering is, if I need to lock all methods? Here's an example:
I have 3 versions of an IndexOf method:
public override void IndexOf(object value) {
return IndexOf(object value, 0)
}
public override void IndexOf(object value, int startIndex) {
return IndexOf(object value, 0, __innerObject.__count);
}
public override void IndexOf(object value, int startIndex, int count) {
lock (__innerObject) {
return (__innerObject.IndexOf(value, startIndex, count);
}
}
is it possible, if i don't lock all the IndexOf methods, that i could get
unexpected results? Or will I be fine since I end up calling a method that
is locked?
Thanks,
Curtis