[omniORB] [omnithread] NT CreateThread function

Rafael del Valle rvalle@globalnet.co.uk
Wed, 22 Apr 1998 12:03:42 +0100


Hello !!

	I'm interested in using your omnithread abstraction, I've looked at the
code and I've seen that you use CreateThread WIN32 function.

	I've been told, in an NT advanced programming course (and also in some
books), to use _beginthreadex C function instead, in order for
multithreaded C and C++ programs that use the C runtime library to work
properly.

	The reason is that C runtime library is not thread safe, and this
function allocates a data structure associated with each thread, used by
the C runtime library functions to solve the problem. This structure
provides, for example, a 'errno' variable for the current thread.

	If you use CreateThread, windows trys to do this automatically but
there are some cases in wich you will get memory leaks.

You can find more information about this in:

	ADVANCED WINDOWS
	The Developers Guide to WIN32 API for Windows NT/95
	JEFFRY RICHTER
	MicrosoftPress
	ISBN 1-55615-677-4
	Pages. 86-93

	I really don't know if this problem has been solved in recent releases
of windows libraries. But I would like to know if you have considered
this problem.

	Thanks in advance.