0

如何同时等待两件或多件事情(不同类型)?就像在事件循环中一样:

while(true) {
    ppl::task<Letter> msg1 = WaitForLetter(); //one letter a month
    ppl::task<SMS> msg2 = WaitForSMS(); //one SMS an hour

    //wait_any. How to do it for tasks of different types?
}
4

1 回答 1

0

I'll answer my own post.

"PPL Power Pack" supports "Heterogeneous when_any":

https://pplpp.codeplex.com/wikipage?title=Heterogeneous%20when_any

On an unrelated note it seems very few people use PPL. There are only 97 PPL tagged questions on stackoverflow. Most have no answers. (TBB has 450, so it seems a slightly more active community)

于 2016-01-25T17:21:23.780 回答