From a670e5ab0f8f7bc2eb1100b1c391d92f1fa36147 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:42:17 +0000 Subject: Utilisateur : Fcolin Date : 4/11/03 Heure : 12:01 Archivé dans $/EScribe/Ivy Commentaire: (vss 10) --- CSharp/Ivy/Ivy/Ivy.cs | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'CSharp/Ivy') diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index cd8a5a0..60c3ff4 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -64,7 +64,7 @@ namespace IvyBus get { String s = appName + " clients are: "; - lock( clients ) + lock( clients.SyncRoot ) { foreach (IvyClient client in clients.Values ) { @@ -249,7 +249,7 @@ namespace IvyBus ((IvyWatcher) watchers[i]).stop(); } // stopping the remaining IvyClients - lock( clients ) + lock( clients.SyncRoot ) { foreach (IvyClient c in clients.Values ) { @@ -286,7 +286,7 @@ namespace IvyBus int count = 0; // an alternate implementation would one sender thread per client // instead of one for all the clients. It might be a performance issue - lock ( clients ) + lock ( clients.SyncRoot ) { foreach (IvyClient client in clients.Values ) { @@ -333,10 +333,10 @@ namespace IvyBus { // creates a new binding (regexp,callback) Int32 key = serial++; - lock (regexp_out) regexp_out.Add( key, regexp); + lock (regexp_out.SyncRoot) regexp_out.Add( key, regexp); lock (callback) callbacks.Add( key, callback); // notifies the other clients this new regexp - lock ( clients ) + lock ( clients.SyncRoot ) { foreach (IvyClient c in clients.Values ) { @@ -357,7 +357,7 @@ namespace IvyBus { throw new IvyException("client wants to remove an unexistant regexp " + id); } - lock( clients ) + lock( clients.SyncRoot ) { foreach (IvyClient c in clients.Values ) { @@ -437,7 +437,7 @@ namespace IvyBus */ internal void removeClient(IvyClient c) { - lock( clients ) + lock( clients.SyncRoot ) { clients.Remove(c.ClientKey); } @@ -467,17 +467,14 @@ namespace IvyBus internal void addClient(MyTcpClient socket) { - lock( clients ) - { - if (stopped) + if (stopped) return ; - IvyClient client = new IvyClient(this,socket); - lock ( clients ) - { - clients.Add( client.ClientKey, client); - } - traceDebug(ClientNames); + IvyClient client = new IvyClient(this,socket); + lock ( clients.SyncRoot ) + { + clients.Add( client.ClientKey, client); } + traceDebug(ClientNames); } internal void callCallback(IvyClient client, Int32 key, String[] tab) @@ -561,7 +558,7 @@ namespace IvyBus { if (clnt.AppPort == 0) return false; - lock( clients ) + lock( clients.SyncRoot ) { foreach (IvyClient client in clients.Values ) { -- cgit v1.1