Subj : Re: Question about: createthread/beginthread/beginthreadex ? To : comp.programming.threads From : David Hopwood Date : Tue Mar 15 2005 02:56 am mandatory wrote: > Well - now we have two different answers out of two posts ? can see why im > confused ? One post said that using CreateThread may leak memory in the C runtime library, and therefore recommended _beginthread[ex] in preference to CreateThread. This is correct as far as it goes. My post pointed out that there are also problems with _beginthread[ex] when using MFC, and recommended AfxBeginThread instead. The two answers are not inconsistent; the first one is just incomplete because it didn't consider MFC. > Now, in my Win32 documentation i cant find AfxBeginThread() That's odd, it is certainly documented in MSDN. Use the index with 'no filter' selected. > - where is this located, which header ? afxwin.h Alexander wrote: > Use pthread_create() provided by MS SFU (pthread-win32 aside for a > moment) and ditch MFC (that's for sure). This is referring to "Windows Services for Unix" (http://www.microsoft.com/windows/sfu/). It's quite debatable whether this is a good thing to depend on in a program that is only using the Win32 API elsewhere. If you have a program that needs to be portable to Unix, then yes, either SFU or pthreads-win32 are worth considering. It is not always possible to ditch MFC, unfortunately. Using AfxBeginThread doesn't create a significant dependency on the rest of MFC (although it does require the MFC DLL). -- David Hopwood .