summaryrefslogtreecommitdiffstats
path: root/winpr/libwinpr/pool/test/TestPoolThread.c
blob: d006ae6f8c5bea113af669a88673f22ae4c7903c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <winpr/crt.h>
#include <winpr/pool.h>

/**
 * Improve Scalability With New Thread Pool APIs:
 * http://msdn.microsoft.com/en-us/magazine/cc16332.aspx
 *
 * Developing with Thread Pool Enhancements:
 * http://msdn.microsoft.com/en-us/library/cc308561.aspx
 *
 * Introduction to the Windows Threadpool:
 * http://blogs.msdn.com/b/harip/archive/2010/10/11/introduction-to-the-windows-threadpool-part-1.aspx
 * http://blogs.msdn.com/b/harip/archive/2010/10/12/introduction-to-the-windows-threadpool-part-2.aspx
 */

int TestPoolThread(int argc, char* argv[])
{
	TP_POOL* pool = NULL;

	WINPR_UNUSED(argc);
	WINPR_UNUSED(argv);

	if (!(pool = CreateThreadpool(NULL)))
	{
		printf("CreateThreadpool failed\n");
		return -1;
	}

	if (!SetThreadpoolThreadMinimum(pool, 8)) /* default is 0 */
	{
		printf("SetThreadpoolThreadMinimum failed\n");
		return -1;
	}

	SetThreadpoolThreadMaximum(pool, 64); /* default is 500 */

	CloseThreadpool(pool);

	return 0;
}