Index: src/ch/task.h
===================================================================
diff -u -N -r4a3c74a38b00e7793d1e61107a824060e6c2ea95 -r1402c0dd569ff5f381835966227f5b2836a755d6
--- src/ch/task.h	(.../task.h)	(revision 4a3c74a38b00e7793d1e61107a824060e6c2ea95)
+++ src/ch/task.h	(.../task.h)	(revision 1402c0dd569ff5f381835966227f5b2836a755d6)
@@ -19,6 +19,7 @@
 #ifndef __TASK_H__
 #define __TASK_H__
 
+#include "TWorkerThreadController.h"
 #include "FileInfo.h"
 #include "DataBuffer.h"
 #include "../libchcore/FeedbackHandlerBase.h"
@@ -340,14 +341,6 @@
 
 	void CalculateTotalSize();
 
-	// m_bKill
-	void SetKillFlag(bool bKill = true);
-	bool GetKillFlag();
-
-	// m_bKilled
-	void SetKilledFlag(bool bKilled = true);
-	bool GetKilledFlag();
-
 	void KillThread();
 	void CleanupAfterKill();
 
@@ -401,14 +394,29 @@
 	size_t GetSessionUniqueID() const { return m_stSessionUniqueID; }
 
 protected:
-	static UINT ThrdProc(LPVOID pParam);
+	static DWORD WINAPI ThrdProc(LPVOID pParam);
 
    void OnBeginOperation();
    void OnEndOperation();
 
 	void CheckForWaitState();
 	void ProcessFiles();
 	void CustomCopyFile(CUSTOM_COPY_PARAMS* pData);
+
+	// Playground
+/*
+	void CustomCopyFile2(CUSTOM_COPY_PARAMS* / *pData* /);
+
+	HANDLE OpenSourceFile(const CString& strPath, bool bNoBuffering/ *, FeedbackSettings* /);
+	HANDLE CreateNewDestinationFile(const CString& strPath, bool bNoBuffering/ *, FeedbackSettings* /);
+	HANDLE OpenExistingDestinationFile(const CString& strPath, bool bNoBuffering/ *, FeedbackSettings* /);
+	void SetEndOfFile(HANDLE hFile);
+	void SeekToPosition(HANDLE hFile, unsigned long long ullPos);
+*/
+
+
+	// End of playground
+
 	void DeleteFiles();
 	void RecurseDirectories();
 	static bool SetFileDirectoryTime(LPCTSTR lpszName, const CFileInfoPtr& spFileInfo);
@@ -454,6 +462,8 @@
 	void SetContinueFlagNL(bool bFlag = true);
 	bool GetContinueFlagNL();
 
+	void RequestStopThread();
+
 private:
 	icpf::log_file m_log;
 	mutable boost::shared_mutex m_lock;	// protection for this class
@@ -487,12 +497,10 @@
 	// buffers
 	BUFFERSIZES m_bsSizes;
 
-	CWinThread *m_pThread;
+	TWorkerThreadController m_workerThread;
+
 	int m_nPriority;
 
-	volatile bool m_bKill;
-	volatile bool m_bKilled;
-
 	// other stuff
 	CString m_strUniqueName;