src/LEA_Lib/Tasks/TaskPool.cs
/// <summary>
///   Add asynchronous task to queue by key
/// </summary>
/// <param name="key"></param>
/// <param name="task"></param>
Add asynchronous task to queue by key
Add asynchronous task to queue by key
public void PushToQueue(String key, TTask task)
        {
            var awaiter = task.GetAwaiter();
            awaiter.OnCompleted(() =>
            {
                lock (locker)
                {
                    ExtractAndRunTask(key);
                }
            });
            lock (locker)
            {
                queueByKey.Enqueue(key, task);
                ExtractAndRunTask(key);
            }
        }
public void PushToQueue ( String key , TTask task ) { var awaiter = task . GetAwaiter ( ) ; awaiter . OnCompleted ( ( ) => { lock ( locker ) { ExtractAndRunTask ( key ) ; } } ) ; lock ( locker ) { queueByKey . Enqueue ( key , task ) ; ExtractAndRunTask ( key ) ; } }
Add asynchronous task to queue by key
Add asynchronous task to queue by key
key
String
None
task
TTask
None