Pthreads in Visual C++

前端 未结 5 2047
小蘑菇
小蘑菇 2021-01-02 06:57

I\'m experimenting with multithreading in Windows and was wondering whether I should

  • use Win32 API
  • use POSIX Threads for Windows

Learni

5条回答
  •  无人及你
    2021-01-02 07:34

    If you're going to do much Windows programming, it will pay to learn the basic Win32 threading constructs: critical sections, interlocked functions, CreateThread, WaitFor*Object, etc. These aren't hard to understand, and they translate transparently to equivalent objects in other threading frameworks.

    However, for more advanced threading constructs such as semaphores, events, etc., I would use the pthreads library, since the documentation on those tends to be clearer and examples more abundant.

提交回复
热议问题