<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>线程 on memory</title>
    <link>https://mem.leabol.top/tags/%E7%BA%BF%E7%A8%8B/</link>
    <description>Recent content in 线程 on memory</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Thu, 11 Jun 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://mem.leabol.top/tags/%E7%BA%BF%E7%A8%8B/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>cpp线程的创建</title>
      <link>https://mem.leabol.top/posts/cpp/cpp%E7%BA%BF%E7%A8%8B/</link>
      <pubDate>Thu, 11 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://mem.leabol.top/posts/cpp/cpp%E7%BA%BF%E7%A8%8B/</guid>
      <description>&lt;h1 id=&#34;线程&#34;&gt;线程&lt;/h1&gt;
&lt;h2 id=&#34;线程的创建&#34;&gt;线程的创建&lt;/h2&gt;
&lt;p&gt;在cpp中线程的创建有两种形式&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;默认构造&lt;/li&gt;
&lt;li&gt;传入可调用对象如: 函数, 函数对象, 对象的成员函数, 对象的静态函数, lambda表达式&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;线程的构造函数&lt;strong&gt;会按值复制所有参数&lt;/strong&gt;,这点很重要, 对于想要传递引用的变量时,要使用&lt;code&gt;std::ref()&lt;/code&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
