Threaded C programs in minGW

前端 未结 3 1105
忘了有多久
忘了有多久 2020-12-06 16:03

I am creating a program that intercepts all packets when a certain link is down. I would need to implement the sniffer and the link-checker as threads. But

3条回答
  •  Happy的楠姐
    2020-12-06 16:35

    MinGW doesn't provide a full POSIX model. If you want threads in the standard package, you'll have to use the Windows variety.

    It states on the MinGW main page:

    MinGW compilers provide access to the functionality of the Microsoft C runtime and some language-specific runtimes. MinGW, being Minimalist, does not, and never will, attempt to provide a POSIX runtime environment for POSIX application deployment on MS-Windows. If you want POSIX application deployment on this platform, please consider Cygwin instead.

    Cygwin does have pthreads support because it provides the Cygwin DLL, an emulation layer, whereas MinGW is more gcc for use with the Windows way of doing things.

    Alternatively, if Cygwin isn't an option, you can look into Pthreads/Win32 which claims to work with MinGW.

提交回复
热议问题