Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DedicatedThreadPool.QueueUserWorkItem<T> generic #6156

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/core/Akka/Helios.Concurrency.DedicatedThreadPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private void ReleaseWorker()
}
}

private struct RequestWorkerTask : IRunnable
private readonly struct RequestWorkerTask : IRunnable
{
private readonly DedicatedThreadPoolTaskScheduler _scheduler;

Expand Down Expand Up @@ -312,7 +312,7 @@ public DedicatedThreadPool(DedicatedThreadPoolSettings settings)
/// This exception is thrown if the given <paramref name="work"/> item is undefined.
/// </exception>
/// <returns>TBD</returns>
public bool QueueUserWorkItem(IRunnable work)
public bool QueueUserWorkItem<T>(T work) where T:IRunnable
{
if (work == null)
throw new ArgumentNullException(nameof(work), "Work item cannot be null.");
Expand Down Expand Up @@ -416,7 +416,7 @@ public bool IsAddingCompleted
get { return Volatile.Read(ref _isAddingCompleted) == CompletedState; }
}

public bool TryAdd(IRunnable work)
public bool TryAdd<T>(T work) where T:IRunnable
{
// If TryAdd returns true, it's guaranteed the work item will be executed.
// If it returns false, it's also guaranteed the work item won't be executed.
Expand Down