www.kbcafe.com
Copyright 2001-2002 Randy Charles Morin
C++ And Threads
by Randy Charles Morin
If you’ve ever done multithreaded programming then most likely it was in C++. I haven’t
heard of many developers using the CreateThread Win32 API function from Visual Basic
or even Delphi. The reason is that the advantages of C++ and multiple threads are usually
the same.
You want more responsiveness from some application. How do you do it? Well you
could have multiple threads in order to limit blocking of one application request by
another. You could also use a more low level language.
It is highly doubtful that you’d program these days in x86 Machine Language or
Assembler. So your next best choice is C++. And still today with the advent of more and
more languages, i.e. Delphi, Visual Basic, Java, Perl, C# and many more, the preferred
performance oriented language remain C++.
The conclusion is that performance oriented applications are generally developed in C++
and with multithreaded C++ libraries. I myself have been doing this for years. I have
written dozens of C++ servers and each had some multithreaded aspects about them.
If you know one thing about me from the previous four paragraphs, you know that I’m a
C++ developer. Generalizing on this theme, you should also realize that I have never
worked for a company for three consecutive years. In fact, I’ve only worked for one
company more than one year. That’s because programmers are the mercenary hired gun
of the third millennium. We develop an application and when you are finished, they
reduce the development staff in half and thirds. Eventually, I move on.
The problem with moving from one company to another is that you have to start all over
each time. You are not legally allowed to move code from company to company, unless
managements concur, which rarely happens.
I once worked for the brother of my previous employer. I thought that maybe this once,
I’d be able to move some code from one company to the next. Well, the two brothers
couldn’t make the ends meet and I was told it was not possible.
So, we developers are doomed to start all over in each project. Start form zero. All that
code we wrote over the years is just not going to help. Cause we have to write it again. Or
do we?
What if, I wrapped all this reusable code into a public library and made it available to
everybody. Then surely, no employer could stop me from using this code at my next
employ, and the next after that.
This is the intent of the article. I’m putting together a reusable library that extends above
what is already available in the standard C run-time libraries and Standard Template
Libraries in the current mix. Let me call it the kbcafe library. Why kbcafe? Cause I own
the kbcafe.com domain.