
Andriy Tylychko (mail.ru) wrote:
4. Looping threads. Proposed design is best-suited for "single-task" threads. You have a task and you'd like to do it in a separate thread. This task has a result, and proposed design accents this. It's can be specific enough, but most of my threads work in loop, taking messages from the queue or just "working" until client explicitly stops them, and so doesn't have any results. So why I should worry about this, where's an interface for me? :)
http://www.pdimov.com/cpp/future.cpp (referenced in N2096) has an example called pooled_executor that does this. N2090 threads and N2094 threads have no results; the result part is managed by N2096 futures (or N2094 tasks.) N2090 and N2096 are my proposals, and N2094 is an alternative proposal from Howard Hinnant.