go - keyword "go" in golang, whether go is a atomic operation?
问题描述
in go programing, we always create a go routine like
go func(){}
i want to know whether keyword "go" is an atomic operation, what if create a go routine fail by this operation.
can i monitor a new go routine created success or not?
Or maybe this keyword "go" create a routine that will never fail.
解决方案
规范没有说明创建 goroutine 或调用函数失败,因此此时的行为取决于实现,并且没有定义确定成功或失败的方法。
您在创建 goroutine 时会遇到的错误类型将是致命错误(可能是由于资源耗尽),而不是可以被优雅地捕获和处理的错误。这类似于您在调用函数时会遇到的各种错误。
推荐阅读
- regex - 如何使用 Powershell 从文件中递归地刮取电子邮件地址?
- java - Firebase 动态链接 java 客户端连接
- java - Amazon SQS 调用 lambda 函数
- javascript - 使用 Thymeleaf spring boot 提交后模式关闭
- sas - SAS 9.4 根据当前值替换当前行之后的所有值
- angular - 在 Angular 中动态更改 styles.scss
- c++ - 在指向函数中读取变量时出现分段错误
- excel - 使用 VBA 脚本错误地读取文本格式为数字
- javascript - Javascript:可变宽度多维数组
- c++ - C++:当所有条目保证唯一时替代 std::map