在 MinGW 中使用线程?
我正在构建一个小工具,需要打开一个线程,并让该线程执行其操作,无论该线程上发生什么,我都不希望它干扰主应用程序,只需执行、处理错误并关闭。
我怎样才能用 mingw 编译器做到这一点?在linux上我可以使用POSIX,但是这个工具只能在win上运行,x86和x64,所以我不知道该怎么做。
I am building a small tool that will need to open a thread, and let the thread do its thing, no matter what happens on that thread I don't want it to interfere with the main app, just execute, handle errors and close.
How can I do this with mingw compiler? On linux I can use POSIX, but this tool will run only on win, both x86 and x64, so I've no idea how to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

除非您想直接使用 Windows 线程,否则您可能需要一个跨平台线程库,例如 pthreads- win32 或 boost:thread
Unless you want to work directly with Windows threads you'll probably want a cross-platform thread library like pthreads-win32 or boost:thread