locked
Concurrency question

    Question

  • Hi,

    I'm new to concurrency, and I have a (possibly stupid) question. Let's say I create a function that uses the task class to start an asynchronous task (task1),  and then call that function within the lambda of another task (task2). If I then say

    task2.then([]() {somethingelse() });

    will somethingelse() get executed after task1 has fully completed, or will it execute concurrently with any subtasks of task1? That is, if there are nested levels of tasks, is there any easy way to control whether or not you want subsequent tasks to depend on the full completion of any subtasks?

    RobertF

     

     

    Saturday, June 30, 2012 3:56 PM

Answers

  • I think I've found the answer to this. The structured_task_group class appears to provide the ability to ensure that nested tasks complete.
    • Marked as answer by Jesse Jiang Monday, July 02, 2012 8:17 AM
    Saturday, June 30, 2012 7:30 PM

All replies

  • I think I've found the answer to this. The structured_task_group class appears to provide the ability to ensure that nested tasks complete.
    • Marked as answer by Jesse Jiang Monday, July 02, 2012 8:17 AM
    Saturday, June 30, 2012 7:30 PM
  • Hello,

    As far as I know, most of function in ALT::CComPtr can be find alternate in WRL::ComPtr.

    Do you have any farther request function in ALT::CComPtr?
     
    Thanks for sharing the solution, we can accordance this document to use task_group

    http://msdn.microsoft.com/en-us/library/windows/apps/dd492427(v=vs.110).aspx

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 02, 2012 8:19 AM