Click here to Skip to main content
15,898,035 members
Articles / Programming Languages / C++

Win32 Thread Pool

Rate me:
Please Sign up or sign in to vote.
4.75/5 (42 votes)
7 Feb 2011CPOL6 min read 182.1K   7.1K   205  
An implementation of a Thread Pool in C++ for Windows
// ThreadPoolAppDlg.h : header file
//
#include "ThreadPool.h"

#if !defined(AFX_THREADPOOLAPPDLG_H__1371D911_4679_4D29_B623_1093F1A2C730__INCLUDED_)
#define AFX_THREADPOOLAPPDLG_H__1371D911_4679_4D29_B623_1093F1A2C730__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CThreadPoolAppDlg dialog

class CThreadPoolAppDlg : public CDialog
{
// Construction
public:
	CThreadPoolAppDlg(CWnd* pParent = NULL);	// standard constructor
	CThreadPool m_pool1;

// Dialog Data
	//{{AFX_DATA(CThreadPoolAppDlg)
	enum { IDD = IDD_THREADPOOLAPP_DIALOG };
		// NOTE: the ClassWizard will add data members here
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CThreadPoolAppDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CThreadPoolAppDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	virtual void OnOK();
	afx_msg void OnButton1();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
public:
	CString m_nPoolSize;
	afx_msg void OnBnClickedButtonCreate();
	afx_msg void OnBnClickedButtonAddwork1();
	afx_msg void OnBnClickedButtonAddwork2();
	afx_msg void OnBnClickedButtonAddwork3();
	afx_msg void OnBnClickedButtonDestroy();
	afx_msg void OnClose();
	afx_msg void OnDestroy();
	afx_msg void OnBnClickedClose();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_THREADPOOLAPPDLG_H__1371D911_4679_4D29_B623_1093F1A2C730__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
My personal website is at http://sbytestream.pythonanywhere.com

Comments and Discussions