[blam] Channel: Also use locking
- From: Carlos Martín Nieto <cmartin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [blam] Channel: Also use locking
- Date: Mon, 11 Oct 2010 20:30:39 +0000 (UTC)
commit 6fbb073f1d8b3f3ff60f9dd8fb12f91ab8c1c579
Author: Carlos MartÃn Nieto <carlos cmartin tk>
Date: Mon Oct 11 21:30:18 2010 +0100
Channel: Also use locking
src/Channel.cs | 34 ++++++++++++++++++++++------------
1 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/src/Channel.cs b/src/Channel.cs
index fe9284c..72e5985 100644
--- a/src/Channel.cs
+++ b/src/Channel.cs
@@ -68,7 +68,9 @@ namespace Imendio.Blam {
public int NrOfItems {
get {
- return item_list.Count;
+ lock(obj){
+ return item_list.Count;
+ }
}
}
@@ -77,10 +79,12 @@ namespace Imendio.Blam {
int unread = 0;
Item item;
- foreach (string id in item_list) {
- item = store.Items[id] as Item;
- if(item != null && item.Unread){
- ++unread;
+ lock(obj){
+ foreach (string id in item_list) {
+ item = store.Items[id] as Item;
+ if(item.Unread){
+ ++unread;
+ }
}
}
@@ -92,10 +96,12 @@ namespace Imendio.Blam {
get {
int new_items = 0;
Item item;
- foreach(string id in item_list){
- item = store.Items[id] as Item;
- if(item != null && item.Unread && !item.Old){
- ++new_items;
+ lock(obj){
+ foreach(string id in item_list){
+ item = store.Items[id] as Item;
+ if(item != null && item.Unread && !item.Old){
+ ++new_items;
+ }
}
}
@@ -105,11 +111,15 @@ namespace Imendio.Blam {
public ArrayList ItemList {
get {
- return item_list;
+ lock(obj){
+ return item_list;
+ }
}
set {
- item_list = value;
- Setup();
+ lock(obj){
+ item_list = value;
+ Setup();
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]