-
CreateThread API
Hello guys, I should say it is an honour to meet you.
Dumb question...
Does the CreateThread still have what it takes ¿
What I mean is, I'm a VB / VB.NET guy, and instead of using the built in Threading classes, i have always preferred doing threading with APIs.
What are the pros and cons ( specific to VS 2010 ) in this regard ¿
Thanx
Hannes
-
Re: CreateThread API
Hannes, I believe CreateThread() is just not guaranteed to work in VB. Isn't it? Your programming system provides an API for thread creation, so use it. For example, in Visual C++ CreateThread() is not quite work (the run-time is dirtily patched to make it work in general, but memory leaks are still possible). Instead, Visual C++ run-time provides special __beginthreadex() function for thread creation, which is a C++ function rather than WinAPI function.
-
Re: CreateThread API
HanneS - What dvyukov said.
I don't know about VB, but if you're using the C Runtime Library (CRT), _beginthreadex does a better job at initializations when starting threads. If you skip those by using _beginthread or CreateThread, there can be problems in other CRT function execution.
For managed code Joe Duffy (Concurrent Programming on Windows) recommends the System.Threading.Thread class and Start methods.
-
Re: CreateThread API
Thanx for your valuable input guys!
Much appreciated :)
I guess I've been using VB 6 for too long, before going to .NET! LOL! :lol: