操作系统完全取决于为多线程提供支持.在
Windows上,可通过Win32 API获得必要的功能.诸如
MFC之类的框架为低级线程函数提供了包装以简化操作,当然.NET / CLR有自己的托管接口来访问Win32多线程功能.
在this article(C中的多线程)中提供了一个很好的解释.
Why Doesn’t C++ Contain Built-In
Support for Multithreading?
C++ does not contain any built-in
support for multithreaded
applications. Instead,it relies
entirely upon the operating system to
provide this feature. Given that both
Java and C# provide built-in support
for multithreading,it is natural to
ask why this isn’t also the case for
C++. The answers are efficiency,
control,and the range of applications
to which C++ is applied. Let’s examine
each.
By not building in support for multithreading,C++ does not attempt to define a “one size fits all” solution. Instead,C++ allows you to directly utilize the multithreading features provided by the operating system. This approach means that your programs can be multithreaded in the most efficient means supported by the execution environment. Because many multitasking environments offer rich support for multithreading,being able to access that support is crucial to the creation of high-performance,multithreaded programs.