<?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>Channel on Sirius&#39; Blog</title>
    <link>https://sirius2alpha.github.io/tags/channel/</link>
    <description>Recent content in Channel on Sirius&#39; Blog</description>
    <image>
      <title>Sirius&#39; Blog</title>
      <url>https://sirius2alpha.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</url>
      <link>https://sirius2alpha.github.io/%3Clink%20or%20path%20of%20image%20for%20opengraph,%20twitter-cards%3E</link>
    </image>
    <generator>Hugo -- 0.127.0</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 10 May 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://sirius2alpha.github.io/tags/channel/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>【go的源码阅读】channel的实现：chan.go</title>
      <link>https://sirius2alpha.github.io/posts/notes/2-areas/%E6%8A%80%E6%9C%AF%E6%A0%88/go/go-channel/</link>
      <pubDate>Fri, 10 May 2024 00:00:00 +0000</pubDate>
      <guid>https://sirius2alpha.github.io/posts/notes/2-areas/%E6%8A%80%E6%9C%AF%E6%A0%88/go/go-channel/</guid>
      <description>channel的简单使用 在Go语言中，通道（channel）是一种用于在goroutine之间进行通信和同步的机制。下面是一些简单的通道使用示例，以及它们对应的底层函数调用。
package main import ( &amp;#34;fmt&amp;#34; &amp;#34;time&amp;#34; ) func main() { ch := make(chan int) // 创建通道 go func() { ch &amp;lt;- 42 // 发送数据到通道 }() go func() { value := &amp;lt;-ch // 从通道接收数据 fmt.Println(&amp;#34;Received:&amp;#34;, value) }() time.Sleep(1 * time.Second) // 等待goroutine完成 close(ch) // 关闭通道 } 底层函数调用 创建通道：
ch := make(chan int) 底层调用：
makechan(elemtype, size) 发送数据到通道：
ch &amp;lt;- 42 底层调用：
chansend(c *hchan, ep unsafe.Pointer, block bool, callerpc uintptr) bool 从通道接收数据：</description>
    </item>
  </channel>
</rss>
