History

GSF.Core: Added ShutdownHandler so ScheduledTask objects can be signaled and disposed of when the application shuts down. Also modified the WeakAction class to be more intuitive.

chishose committed 10 years ago

Commit 74b3a471 parent c6557e811 files · +728 −278Browse files

Showing the changes to Source/Libraries/GSF.Core.Shared/Threading/ThreadContainerThreadpool.cs (1 of 11 files). Show all

Unified · Split

Source/Libraries/GSF.Core.Shared/Threading/ThreadContainerThreadpool.cs+9−3
@@ -16,12 +16,13 @@ · 15 unmodified lines
1616 //
1717 // Code Modification History:
1818 // ----------------------------------------------------------------------------------------------------
19−// 3/8/2014 - Steven E. Chisholm
19+// 03/08/2014 - Steven E. Chisholm
2020 // Generated original version of source code.
2121 //
2222 //
2323 //******************************************************************************************************
2424
25+using System;
2526 using System.Diagnostics.CodeAnalysis;
2627 using System.Threading;
2728
@@ -41,9 +42,14 @@ namespace GSF.Threading · 13 unmodified lines
4142 /// </summary>
4243 private ManualResetEvent m_waitObject;
4344
44− public ThreadContainerThreadpool(WeakAction<CallbackArgs> callback)
45− : base(callback)
45+ public ThreadContainerThreadpool(Action<CallbackArgs> callback, Action disposeAndWaitCallback, bool disposeOnShutdown)
46+ : base(callback, disposeAndWaitCallback, disposeOnShutdown)
4647 {
48+ if (disposeOnShutdown)
49+ {
50+ ShutdownHandler.TryRegisterCallback(Shutdown);
51+ }
52+
4753 m_waitObject = new ManualResetEvent(false);
4854 }
4955

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t