Choose between C runtime library and Win32 API
-
Hi, It's not easy to choose between functions in C runtime library and Win32 API, for example, CreateThread() and EndTread() are in Win32 API, _beginthreadex() and _endthreadex() in C runtime library. Can anybody tell me the difference and reason why I should choose one of then instead of the other. Thank you in advance. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
-
Hi, It's not easy to choose between functions in C runtime library and Win32 API, for example, CreateThread() and EndTread() are in Win32 API, _beginthreadex() and _endthreadex() in C runtime library. Can anybody tell me the difference and reason why I should choose one of then instead of the other. Thank you in advance. Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
In this case, I believe you should choose the C runtime, because I seem to recall Richter had bad things to say about CreateThread and EndThread. As a rule, I prefer C++ over C functions, and standard functions over M$ specific ones, but overall for something OS dependant like threading I would go with the M$ ones, except in this case where Jeff Richter says not to. There, was that confusing enough for you ? :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?! - Jon Hulatt, 22/3/2002
-
In this case, I believe you should choose the C runtime, because I seem to recall Richter had bad things to say about CreateThread and EndThread. As a rule, I prefer C++ over C functions, and standard functions over M$ specific ones, but overall for something OS dependant like threading I would go with the M$ ones, except in this case where Jeff Richter says not to. There, was that confusing enough for you ? :-) Christian The tragedy of cyberspace - that so much can travel so far, and yet mean so little. "I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?! - Jon Hulatt, 22/3/2002
Hi CG, Richter's advice was that we should use _beginthreadex if we plan on using CRT functions inside our thread. But if we are not, then we might as well use the API calls to start threads Nish
_
If I am awake and my eyes are closed, it does not necessarily mean that I am thinking of naked women._