Class ManagedThread
Managed thread.
Inheritance
System.Object
ManagedThread
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class ManagedThread : object
Constructors
ManagedThread(Action1<ManagedThread>)
Initializes a new instance of the ManagedThread class.
Declaration
public ManagedThread(Action1<ManagedThread> loop)
Parameters
Type | Name | Description |
---|---|---|
Action1<ManagedThread> | loop | The loop to run on the thread. |
Properties
CurrentThreadId
Gets the id for the current thread.
Declaration
public static long CurrentThreadId { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
Delay(Int64)
Returns a promise that gets resolved after a specified amount of time.
Declaration
public static Future<object> Delay(long millis)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | millis | The length of time to delay in milliseconds. Cannot be greater than 2,147,483,646 ms. |
Returns
Type | Description |
---|---|
Future<System.Object> | Promise that gets resolved when the delay is complete. |
Dispatch(Action0)
Dispatches an action to a background thread.
Declaration
public static void Dispatch(Action0 action)
Parameters
Type | Name | Description |
---|---|---|
Action0 | action | The action. |
Dispatch(Function0<System.Threading.Tasks.Task>)
Dispatches an action to a background thread.
Declaration
public static void Dispatch(Function0<System.Threading.Tasks.Task> action)
Parameters
Type | Name | Description |
---|---|---|
Function0<System.Threading.Tasks.Task> | action | The action. |
LoopBegin()
Should be invoked when the loop begins before other code.
Declaration
public void LoopBegin()
LoopEnd()
Should be invoked when the loop ends after other code.
Declaration
public void LoopEnd()
Sleep(Int32)
Sleeps the current thread for a specified period of time.
Declaration
public static void Sleep(int millisecondsTimeout)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | millisecondsTimeout | The length of time to sleep in milliseconds. |
Start()
Starts the thread.
Declaration
public void Start()