Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the preliminary study of multithreading in Category 11

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

I believe that Linux programmers have used Pthread, but with the std::thread of Clover 11, you can write multithreaded programs at the language level, the direct benefit is that the portability of multithreaded programs has been greatly improved, so as a C++ programmer, it is very beneficial to be familiar with the multithreaded programming way of Clover 11.

If you are not familiar with Category 11, I have also collected some information about it for your reference:

Data transfer http://www.open-std.org/jtc1/sc22/wg21/

C++0x/C++11 Support in GCC: http://gcc.gnu.org/projects/cxx0x.html

What is Clippers 0x: https://www2.research.att.com/~bs/what-is-2009.pdf

Overview of the New clients: http://www.artima.com/shop/overview_of_the_new_cpp

Overview of the New C++ (Clippers 0x) .pdf: http://ishare.iask.sina.com.cn/f/20120005.html?from=likeA Brief Look at Clippers 0x: http://www.artima.com/cppsource/cpp0x.html

Summary of clients 11 Feature Availability in gcc and MSVC: http://www.aristeia.com/C++11/C++11FeatureAvailability.htm

C++ 11: Come Closer: http://www.codeproject.com/Articles/344282/Cplusplus-11-Come-Closer

11 threads, locks and condition variables: http://www.codeproject.com/Articles/598695/Cplusplus11-threads-locks-and-condition-variables

Move Semantics and Perfect Forwarding in Clearing 11: http://www.codeproject.com/Articles/397492/Move-Semantics-and-Perfect-Forwarding-in-Cplusplus

Http://solarianprogrammer.com/categories/C++11/

Clear11 Concurrency: http://www.baptiste-wicht.com/2012/03/cpp11-concurrency-part1-start-threads/

Http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/sfacm-cleaned.pdf

Http://en.cppreference.com/w/cpp/thread

Http://isocpp.org/blog/2012/12/c11-a-cheat-sheet-alex-sinyakov

The Biggest Changes in Clearing 11: http://blog.smartbear.com/c-plus-plus/the-biggest-changes-in-c11-and-why-you-should-care/

Ten customers 11 Features Every C++ Developer Should Use: http://www.codeproject.com/Articles/570638/Ten-Cplusplus11-Features-Every-Cplusplus-Developer

Caterpillar 11-A Glance [part 1 of n]: http://www.codeproject.com/Articles/312029/Cplusplus11-A-Glance-part-1-of-n

Caterpillar 11-A Glance [part 2 of n]: http://www.codeproject.com/Articles/314415/Cplusplus11-A-Glance-part-2-of-n

Clocked 11 (and modern C++ style) and fast iterative development: http://mindhacks.cn/2012/08/27/modern-cpp-practices/

Lambda Functions in Clearing 11-the Definitive Guide: http://www.cprogramming.com/c++11/c++11-lambda-closures.html

Better types in Clearing 11-nullptr, enum classes (strongly typed enumerations) and cstdint: http://www.cprogramming.com/c++11/c++11-nullptr-strongly-typed-enum-class.html

Rvalue-references-and-move-semantics-in-c++11: http://www.cprogramming.com/c++11/rvalue-references-and-move-semantics-in-c++11.html

Http://www.gotw.ca/publications/index.htm

Http://www.devx.com/SpecialReports/Door/38865

Multi-threading in Clippers 0x: http://accu.org/index.php/journals/1584

C++ 0X feature summary cheat sheat: http://www.iesensor.com/blog/2011/05/31/c-0x-feature-summary-cheat-sheat/

Multithreading in Clearing 0x part 1: Starting Threads: http://www.justsoftwaresolutions.co.uk/threading/multithreading-in-c++0x-part-1-starting-threads.html

Http://en.cppreference.com/w/cpp/thread

Http://www.cplusplus.com/reference/multithreading/

All right, let's get down to business.

Header files related to Clippers 11 multithreading

Four header files have been introduced to support multithreaded programming in the new standard, namely, and.

This headline mainly declares two classes, std::atomic and std::atomic_flag, as well as a set of C-style atomic types and functions for C-compatible atomic operations. This header file mainly declares the std::thread class, and the std::this_thread namespace is also in the header file. This header file mainly declares classes related to mutex, including std::mutex series classes, std::lock_guard, std::unique_lock, and other types and functions. This header file mainly declares classes related to conditional variables, including std::condition_variable and std::condition_variable_any. The header file mainly declares two Provider classes, std::promise and std::package_task, and two Future classes, std::future and std::shared_future, as well as some related types and functions. The std::async () function is declared in this header file.

Std::thread "Hello world"

Here is the simplest example of using the std::thread class:

# include # include # include / / std::cout#include / / std::threadvoid thread_task () {std::cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report