summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CSharp/Ivy/Ivy/Ivy.cs12
1 files changed, 7 insertions, 5 deletions
diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs
index ee55369..3a7a20d 100644
--- a/CSharp/Ivy/Ivy/Ivy.cs
+++ b/CSharp/Ivy/Ivy/Ivy.cs
@@ -326,7 +326,7 @@ namespace IvyBus
internal Dictionary<int, ApplicationBinding> bindings;
private List<IvyClient> clients;
private string[] sent_messageClasses = null;
- private bool stopped = false;
+ private bool stopped = true;
internal ushort applicationPort; /* Application port number */
internal IPAddress applicationHost; /* Application host number */
internal string applicationUniqueId; /* identifier Application unique timestamp-ipaddress-port */
@@ -534,10 +534,10 @@ namespace IvyBus
/// </summary>
public void stop()
{
- lock (this)
+ if (stopped)
+ return;
+ lock (app)
{
- if (stopped)
- return;
stopped = true;
traceDebug("beginning stopping the bus");
try
@@ -546,7 +546,9 @@ namespace IvyBus
if (serverThread != null)
{
app.Stop();
- serverThread.Join();
+ // Wait for Thread to end.
+ bool term = serverThread.Join(10000);
+ if (!term && (serverThread != null)) serverThread.Abort();
serverThread = null;
}
// The serverThread might be stopped even before having been created