簡體   English   中英

goroutine調用中channel receive operator的阻塞行為

[英]Blocking behavior of channel receive operator in goroutine call

go DelegateWork(mr, <-mr.impl.readyWorkers, jobArgs)    

在上面的例子中,通道接收運算符會導致調用者或被調用的 goroutine 阻塞嗎?

規格:Go 聲明:

function 值和參數在調用 goroutine 中照常計算,但與常規調用不同,程序執行不會等待調用的 function 完成。 相反,function 開始在一個新的 goroutine 中獨立執行。

因此,如果<-mr.impl.readyWorkers阻塞,它會在啟動新的 goroutine 之前阻塞調用者 goroutine。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM