在Windows和Linux上的线程 [英] Threading on both Windows and Linux

查看:162
本文介绍了在Windows和Linux上的线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在互联网上看过有关在Windows上使用C ++编写多线程应用程序的教程,以及其他在Linux上执行相同操作的教程,但不能同时使用。是否有功能即使在Linux或Windows上编译也可以工作?

I have seen tutorials on the internet for making multithreaded applications in C++ on Windows, and other tutorials for doing the same on Linux, but not for both at the same time. Are there functions that would work even if they were compiled on either Linux or Windows?

推荐答案

包含Linux上的 pthread 和Windows上的Win32线程库( CreateThread 和朋友)的实现。

You would need to use a library which contains an implementation for both pthread on Linux and the Win32 threading library on Windows (CreateThread and friends).

Boost线程是将系统抽象化的流行选择。

Boost thread is a popular choice which abstracts the system away.

这篇关于在Windows和Linux上的线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆