[ 
https://issues.apache.org/jira/browse/IGNITE-1791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel  Tupitsyn updated IGNITE-1791:
------------------------------------
    Description: 
Currently we use TaskFactory.FromAsync to create tasks and return them from 
API. This requires implementing IAsyncResult, which has a heavyweight 
WaitHandle inside. TaskFactory then uses ThreadPool.RegisterWaitForSingleObject 
to wait on that handle and set task completion. 

Creating WaitHandle and waiting on it are redundant extra steps.
[TaskCompletionSource|https://msdn.microsoft.com/en-us/library/dd449174(v=vs.100).aspx]
 allows lighter-weight approach.

  was:
Currently we use TaskFactory.FromAsync to create tasks and return them from 
API. This requires implementing IAsyncResult, which has a heavyweight 
WaitHandle inside. TaskFactory then uses ThreadPool.RegisterWaitForSingleObject 
to wait on that handle and set task completion. 

Creating WaitHandle and waiting on it are redundant extra steps.
System.Threading.Task has internal API to create "promise-style" task and then 
set it to completed state when needed.


> .Net: Improve Task-based async API efficiency with TaskCompletionSource
> -----------------------------------------------------------------------
>
>                 Key: IGNITE-1791
>                 URL: https://issues.apache.org/jira/browse/IGNITE-1791
>             Project: Ignite
>          Issue Type: Improvement
>          Components: interop
>    Affects Versions: 1.5
>            Reporter: Pavel  Tupitsyn
>            Assignee: Pavel  Tupitsyn
>             Fix For: 1.5
>
>
> Currently we use TaskFactory.FromAsync to create tasks and return them from 
> API. This requires implementing IAsyncResult, which has a heavyweight 
> WaitHandle inside. TaskFactory then uses 
> ThreadPool.RegisterWaitForSingleObject to wait on that handle and set task 
> completion. 
> Creating WaitHandle and waiting on it are redundant extra steps.
> [TaskCompletionSource|https://msdn.microsoft.com/en-us/library/dd449174(v=vs.100).aspx]
>  allows lighter-weight approach.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to