This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Linking to cygwin1.dll and msvcrt.dll ?


On Thu, 19 Jul 2001, Mo DeJong wrote:

> Of course, there may still be a problem. The reason Tcl started
> using _beginthreadex() instead of CreateThread() was related
> to memory that would not be deallocated after a call to
> ExitThread(). Here are some docs I found on the subject.
> 
> http://support.microsoft.com/support/kb/articles/q132/0/78.asp
> http://www.microsoft.com/msj/0799/win32/win320799.htm
> http://technology.niagarac.on.ca/courses/comp831/win32/_beginthread.htm 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_crt__beginthread.2c_._beginthreadex.asp
> 
> My question is, is this same memory leak problem going
> to show up when using Cygwin's CreateThread() and
> C library APIs?

I believe the memory leak is only applicable if you're using MSVCRT
runtime, but that's not the case with Cygwin. The *ex functions close
the various handles and TLS' that are created per thread if I remember 
correctly. 

> Even if this is not going to be a problem, should
> Cygwin provide the _beginthread, _beginthreadex,
> _endthread, and _endthreadex methods to ease
> porting existing apps that have already dealt
> with this issue?

It's tempting, but IMO Cygwin should stay away from creeping feature'ism
such as this. Most of the threaded applications I see tend to use Win32
API directly, and Cygwin of course supports that just fine. Of course, we
can always have msvcrt helper/port library that can facilitate ports.

Regards,
Mumit



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]