1*67c11716SAlexey Oralov.. _When_Task-Based_Programming_Is_Inappropriate:
2*67c11716SAlexey Oralov
3*67c11716SAlexey OralovWhen Task-Based Programming Is Inappropriate
4*67c11716SAlexey Oralov============================================
5*67c11716SAlexey Oralov
6*67c11716SAlexey Oralov
7*67c11716SAlexey OralovUsing the task scheduler is usually the best approach to threading for
8*67c11716SAlexey Oralovperformance, however there are cases when the task scheduler is not
9*67c11716SAlexey Oralovappropriate. The task scheduler is intended for high-performance
10*67c11716SAlexey Oralovalgorithms composed from non-blocking tasks. It still works if the tasks
11*67c11716SAlexey Oralovrarely block. However, if threads block frequently, there is a
12*67c11716SAlexey Oralovperformance loss when using the task scheduler because while the thread
13*67c11716SAlexey Oralovis blocked, it is not working on any tasks. Blocking typically occurs
14*67c11716SAlexey Oralovwhile waiting for I/O or mutexes for long periods. If threads hold
15*67c11716SAlexey Oralovmutexes for long periods, your code is not likely to perform well
16*67c11716SAlexey Oralovanyway, no matter how many threads it has. If you have blocking tasks,
17*67c11716SAlexey Oralovit is best to use full-blown threads for those. The task scheduler is
18*67c11716SAlexey Oralovdesigned so that you can safely mix your own threads with |full_name| tasks.
19*67c11716SAlexey Oralov
20