The Shared helper is now obsolete (singletons are just too bad, not even suitable as workaround for static methods in interfaces for generic types; some cosmetic changes; made the ThreadRunner public

git-svn-id: file:///srv/devel/repo-conversion/nusu@333 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2019-02-02 12:47:07 +00:00
parent 2f82a2fdf9
commit 97183d2335
7 changed files with 24 additions and 19 deletions

View file

@ -37,7 +37,9 @@ namespace Nuclex.Support.Threading {
#region class TestWorker
/// <summary>Implementation of a background worker used for unit testing</summary>
#pragma warning disable 0618
private class TestWorker : ParallelBackgroundWorker<object> {
#pragma warning restore 0618
/// <summary>Initializes a new parallel background worker with unlimited threads</summary>
public TestWorker() : base() { }

View file

@ -30,6 +30,7 @@ namespace Nuclex.Support.Threading {
/// <summary>Processes tasks in parallel using many threads</summary>
/// <typeparam name="TTask">Type of tasks the class will process</typeparam>
[Obsolete("Use ThreadRunner instead; UI view models should inherit ThreadedViewModel")]
public abstract class ParallelBackgroundWorker<TTask> : IDisposable {
/// <summary>Number of CPU cores available on the system</summary>
@ -61,7 +62,7 @@ namespace Nuclex.Support.Threading {
if(threadCount > 0) {
this.threadCount = threadCount;
} else {
threadCount = Math.Max(1, ProcessorCount + threadCount);
this.threadCount = Math.Max(1, ProcessorCount + threadCount);
}
this.queueSynchronizationRoot = new object();
@ -79,7 +80,7 @@ namespace Nuclex.Support.Threading {
/// <param name="name">Name that will be assigned to the worker threads</param>
public ParallelBackgroundWorker(string name) :
this(int.MaxValue) {
threadName = name;
this.threadName = name;
}
/// <summary>
@ -98,7 +99,7 @@ namespace Nuclex.Support.Threading {
/// </remarks>
public ParallelBackgroundWorker(string name, int threadCount) :
this(threadCount) {
threadName = name;
this.threadName = name;
}
/// <summary>Immediately releases all resources owned by the instance</summary>
@ -317,7 +318,6 @@ namespace Nuclex.Support.Threading {
/// use this method of synchronization!
/// </para>
/// </remarks>
///
private object queueSynchronizationRoot;
/// <summary>Delegate for the runQueuedTasksInThread() method</summary>

View file

@ -29,7 +29,7 @@ using System.Threading.Tasks;
namespace Nuclex.Support.Threading {
/// <summary>Executes actions in a threads</summary>
internal abstract class ThreadRunner : IDisposable {
public abstract class ThreadRunner : IDisposable {
#region interface IRunner