Show / Hide Table of Contents

Class SafeBlockingTasks

Inheritance
object
SafeBlockingTasks
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public static class SafeBlockingTasks

Methods

SafeBlock(Action)

Declaration
public static void SafeBlock(Action action)
Parameters
Type Name Description
Action action
Remarks

Use this when you have a synchronous method that you know invokes sync-over-async somewhere in the call stack

SafeBlock(Func<Task>)

Helper method to do a "safe" block on a Task instance, by "safe" we mean that it does not deadlock. ThreadPool starvation could be a possibility if it's overused, however this should not be a problem, because it is only intended for the limited areas of the code that is planned to be dropped in the future. Everywhere else should use real async/await all the way.

Declaration
public static void SafeBlock(Func<Task> task)
Parameters
Type Name Description
Func<Task> task

SafeBlock<T>(Func<Task<T>>)

Declaration
public static T SafeBlock<T>(Func<Task<T>> task)
Parameters
Type Name Description
Func<Task<T>> task
Returns
Type Description
T
Type Parameters
Name Description
T

SafeBlock<T>(Func<T>)

Declaration
public static T SafeBlock<T>(Func<T> action)
Parameters
Type Name Description
Func<T> action
Returns
Type Description
T
Type Parameters
Name Description
T
Remarks

Use this when you have a synchronous method that you know invokes sync-over-async somewhere in the call stack

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top