Mercurial > projects > dwt-addons
diff dwtx/dwtxhelper/Collection.d @ 199:eb98a5cbfd78
Fix: potential problem with synchronized, thx torhu.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 13 Mar 2009 17:03:26 +0100 |
parents | 489eb3f36068 |
children |
line wrap: on
line diff
--- a/dwtx/dwtxhelper/Collection.d Thu Feb 19 17:21:08 2009 +0100 +++ b/dwtx/dwtxhelper/Collection.d Fri Mar 13 17:03:26 2009 +0100 @@ -2498,36 +2498,36 @@ private List list; private this( List list ){ this.list = list; } // Collection - public int opApply (int delegate(ref Object value) dg){ synchronized{ return this.list.opApply(dg); } } + public int opApply (int delegate(ref Object value) dg){ synchronized(this){ return this.list.opApply(dg); } } // List - public void add(int index, Object element){ synchronized{ return this.list.add(index, element); } } - public bool add(Object o){ synchronized{ return this.list.add(o); } } - public bool add(String o){ synchronized{ return this.list.add(o); } } - public bool addAll(Collection c){ synchronized{ return this.list.addAll(c); } } - public bool addAll(int index, Collection c){ synchronized{ return this.list.addAll(index, c); } } - public void clear(){ synchronized{ return this.list.clear(); } } - public bool contains(Object o){ synchronized{ return this.list.contains(o); } } - public bool contains(String o){ synchronized{ return this.list.contains(o); } } - public bool containsAll(Collection c){ synchronized{ return this.list.containsAll(c); } } - public int opEquals(Object o){ synchronized{ return this.list.opEquals(o); } } - public Object get(int index){ synchronized{ return this.list.get(index); } } - public hash_t toHash(){ synchronized{ return this.list.toHash(); } } - public int indexOf(Object o){ synchronized{ return this.list.indexOf(o); } } - public bool isEmpty(){ synchronized{ return this.list.isEmpty(); } } - public Iterator iterator(){ synchronized{ return this.list.iterator(); } } - public int lastIndexOf(Object o){ synchronized{ return this.list.lastIndexOf(o); } } - public ListIterator listIterator(){ synchronized{ return this.list.listIterator(); } } - public ListIterator listIterator(int index){ synchronized{ return this.list.listIterator(index); } } - public Object remove(int index){ synchronized{ return this.list.remove(index); } } - public bool remove(Object o){ synchronized{ return this.list.remove(o); } } - public bool remove(String o){ synchronized{ return this.list.remove(o); } } - public bool removeAll(Collection c){ synchronized{ return this.list.removeAll(c); } } - public bool retainAll(Collection c){ synchronized{ return this.list.retainAll(c); } } - public Object set(int index, Object element){ synchronized{ return this.list.set(index,element); } } - public int size(){ synchronized{ return this.list.size(); } } - public List subList(int fromIndex, int toIndex){ synchronized{ return this.list.subList(fromIndex,toIndex); } } - public Object[] toArray(){ synchronized{ return this.list.toArray(); } } - public Object[] toArray(Object[] a){ synchronized{ return this.list.toArray(a); } } + public void add(int index, Object element){ synchronized(this){ return this.list.add(index, element); } } + public bool add(Object o){ synchronized(this){ return this.list.add(o); } } + public bool add(String o){ synchronized(this){ return this.list.add(o); } } + public bool addAll(Collection c){ synchronized(this){ return this.list.addAll(c); } } + public bool addAll(int index, Collection c){ synchronized(this){ return this.list.addAll(index, c); } } + public void clear(){ synchronized(this){ return this.list.clear(); } } + public bool contains(Object o){ synchronized(this){ return this.list.contains(o); } } + public bool contains(String o){ synchronized(this){ return this.list.contains(o); } } + public bool containsAll(Collection c){ synchronized(this){ return this.list.containsAll(c); } } + public int opEquals(Object o){ synchronized(this){ return this.list.opEquals(o); } } + public Object get(int index){ synchronized(this){ return this.list.get(index); } } + public hash_t toHash(){ synchronized(this){ return this.list.toHash(); } } + public int indexOf(Object o){ synchronized(this){ return this.list.indexOf(o); } } + public bool isEmpty(){ synchronized(this){ return this.list.isEmpty(); } } + public Iterator iterator(){ synchronized(this){ return this.list.iterator(); } } + public int lastIndexOf(Object o){ synchronized(this){ return this.list.lastIndexOf(o); } } + public ListIterator listIterator(){ synchronized(this){ return this.list.listIterator(); } } + public ListIterator listIterator(int index){ synchronized(this){ return this.list.listIterator(index); } } + public Object remove(int index){ synchronized(this){ return this.list.remove(index); } } + public bool remove(Object o){ synchronized(this){ return this.list.remove(o); } } + public bool remove(String o){ synchronized(this){ return this.list.remove(o); } } + public bool removeAll(Collection c){ synchronized(this){ return this.list.removeAll(c); } } + public bool retainAll(Collection c){ synchronized(this){ return this.list.retainAll(c); } } + public Object set(int index, Object element){ synchronized(this){ return this.list.set(index,element); } } + public int size(){ synchronized(this){ return this.list.size(); } } + public List subList(int fromIndex, int toIndex){ synchronized(this){ return this.list.subList(fromIndex,toIndex); } } + public Object[] toArray(){ synchronized(this){ return this.list.toArray(); } } + public Object[] toArray(Object[] a){ synchronized(this){ return this.list.toArray(a); } } } static List synchronizedList(List list){ return new SynchronizedList(list); @@ -2545,30 +2545,30 @@ private this( Map map ){ this.map = map; } - public void clear(){ synchronized{ this.map.clear(); } } - public bool containsKey(Object key){ synchronized{ return this.map.containsKey(key); } } - public bool containsKey(String key){ synchronized{ return this.map.containsKey(key); } } - public bool containsValue(Object value){ synchronized{ return this.map.containsValue(value); } } - public Set entrySet(){ synchronized{ return this.map.entrySet(); } } - public int opEquals(Object o){ synchronized{ return this.map.opEquals(o); } } - public Object get(Object key){ synchronized{ return this.map.get(key); } } - public Object get(String key){ synchronized{ return this.map.get(key); } } - public hash_t toHash(){ synchronized{ return this.map.toHash(); } } - public bool isEmpty(){ synchronized{ return this.map.isEmpty(); } } - public Set keySet(){ synchronized{ return this.map.keySet(); } } - public Object put(Object key, Object value){ synchronized{ return this.map.put(key,value); } } - public Object put(String key, Object value){ synchronized{ return this.map.put(key,value); } } - public Object put(Object key, String value){ synchronized{ return this.map.put(key,value); } } - public Object put(String key, String value){ synchronized{ return this.map.put(key,value); } } - public void putAll(Map t){ synchronized{ return this.map.putAll(t); } } - public Object remove(Object key){ synchronized{ return this.map.remove(key); } } - public Object remove(String key){ synchronized{ return this.map.remove(key); } } - public int size(){ synchronized{ return this.map.size(); } } - public Collection values(){ synchronized{ return this.map.values(); } } + public void clear(){ synchronized(this){ this.map.clear(); } } + public bool containsKey(Object key){ synchronized(this){ return this.map.containsKey(key); } } + public bool containsKey(String key){ synchronized(this){ return this.map.containsKey(key); } } + public bool containsValue(Object value){ synchronized(this){ return this.map.containsValue(value); } } + public Set entrySet(){ synchronized(this){ return this.map.entrySet(); } } + public int opEquals(Object o){ synchronized(this){ return this.map.opEquals(o); } } + public Object get(Object key){ synchronized(this){ return this.map.get(key); } } + public Object get(String key){ synchronized(this){ return this.map.get(key); } } + public hash_t toHash(){ synchronized(this){ return this.map.toHash(); } } + public bool isEmpty(){ synchronized(this){ return this.map.isEmpty(); } } + public Set keySet(){ synchronized(this){ return this.map.keySet(); } } + public Object put(Object key, Object value){ synchronized(this){ return this.map.put(key,value); } } + public Object put(String key, Object value){ synchronized(this){ return this.map.put(key,value); } } + public Object put(Object key, String value){ synchronized(this){ return this.map.put(key,value); } } + public Object put(String key, String value){ synchronized(this){ return this.map.put(key,value); } } + public void putAll(Map t){ synchronized(this){ return this.map.putAll(t); } } + public Object remove(Object key){ synchronized(this){ return this.map.remove(key); } } + public Object remove(String key){ synchronized(this){ return this.map.remove(key); } } + public int size(){ synchronized(this){ return this.map.size(); } } + public Collection values(){ synchronized(this){ return this.map.values(); } } // only for D - public int opApply (int delegate(ref Object value) dg){ synchronized{ return this.map.opApply( dg ); } } - public int opApply (int delegate(ref Object key, ref Object value) dg){ synchronized{ return this.map.opApply( dg ); } } + public int opApply (int delegate(ref Object value) dg){ synchronized(this){ return this.map.opApply( dg ); } } + public int opApply (int delegate(ref Object key, ref Object value) dg){ synchronized(this){ return this.map.opApply( dg ); } } } static Map synchronizedMap(Map m){ return new SynchronizedMap(m);