Skip to content

Commit

Permalink
Calling fb_shutdown only on process exit (DNET-879).
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Apr 29, 2019
1 parent 362f74e commit 9fc62b9
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -30,8 +30,8 @@ static ShutdownHelper()
_pools = new ConcurrentBag<Action>();
_fbClients = new ConcurrentBag<Action>();
#if !NETSTANDARD1_6
AppDomain.CurrentDomain.DomainUnload += (sender, e) => HandleShutdown();
AppDomain.CurrentDomain.ProcessExit += (sender, e) => HandleShutdown();
AppDomain.CurrentDomain.DomainUnload += (sender, e) => HandleDomainUnload();
AppDomain.CurrentDomain.ProcessExit += (sender, e) => HandleProcessShutdown();
#endif
}

Expand All @@ -45,10 +45,15 @@ internal static void RegisterFbClientShutdown(Action item)
_fbClients.Add(item);
}

static void HandleShutdown()
static void HandleDomainUnload()
{
foreach (var item in _pools)
item();
}

static void HandleProcessShutdown()
{
HandleDomainUnload();
foreach (var item in _fbClients)
item();
}
Expand Down

0 comments on commit 9fc62b9

Please sign in to comment.