QQ wrote:
I am new here and got lost on a multithread C++ system
source codes
Are you reading that source to learn? Are you on the job and must change it?
Or are you writing a new program with threads?
From the top: C++ does not define any Standard thread functions. Every
implementation of C++ is different, and exposes various different OS
threading facilities. To learn from existing source, or change it, you must
research only the specific threading library (ZThread?) involved. They are
all different, and a generic introductory book might not cover your library.
If you are writing a new program, don't thread. Always start with a fully
event-driven design, so you won't need threading for as long as possible.
Make sure all your long processes are interruptible. Don't write a loop
statement if you can store its index in a data member and loop from driver
code.
Premature threading can lead to a bad design - and simply horrible bugs as
the threads conflict over resoures. An event driven design, however,
typically forces your program to use a clean and healthy object model. This
makes threads easy and safe to retrofit if you then find a real reason for
them.
--
Phlip
http://www.c2.com/cgi/wiki?ZeekLand