-
April 19th, 2010, 11:44 AM
#1
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
-
April 20th, 2010, 01:42 AM
#2
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.
-
April 21st, 2010, 11:46 AM
#3
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.
Clay Breshears
Intel Innovative Software Education
"There are no evil threads; just threads programmed for evil."
-
April 22nd, 2010, 12:55 AM
#4
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|