当前位置: 首页 > news >正文

网站备案账号是什么app推广拉新一手渠道代理

网站备案账号是什么,app推广拉新一手渠道代理,找代理做网站网站域名归属谁,制作网站工具数据结构与底层实现 Goroutine结构体 stack(栈内存范围) 结构体类型,包含 lo(低地址)和 hi(高地址)两个 uintptr 字段,描述 Goroutine 的栈内存区间 [lo, hi)。初始栈大小为 2KB&a…

数据结构与底层实现

Goroutine结构体

stack(栈内存范围)
结构体类型,包含 lo(低地址)和 hi(高地址)两个 uintptr 字段,描述 Goroutine 的栈内存区间 [lo, hi)。初始栈大小为 2KB,可动态扩容至 1GB。

m(Machine 绑定)
指向当前运行此 Goroutine 的内核线程(M)。调度器通过 M 将 Goroutine 映射到操作系统线程。

_panic 和 _defer(异常与延迟调用链)

  • _panic:指向当前最内层的 panic 结构体链表,处理异常传播。
  • _defer:指向延迟调用(defer)链表,按后进先出(LIFO)顺序执行清理操作。
type g struct {// Stack parameters.// stack describes the actual stack memory: [stack.lo, stack.hi).// stackguard0 is the stack pointer compared in the Go stack growth prologue.// It is stack.lo+StackGuard normally, but can be StackPreempt to trigger a preemption.// stackguard1 is the stack pointer compared in the //go:systemstack stack growth prologue.// It is stack.lo+StackGuard on g0 and gsignal stacks.// It is ~0 on other goroutine stacks, to trigger a call to morestackc (and crash).stack       stack   // offset known to runtime/cgostackguard0 uintptr // offset known to liblinkstackguard1 uintptr // offset known to liblink_panic    *_panic // innermost panic - offset known to liblink_defer    *_defer // innermost deferm         *m      // current m; offset known to arm liblinksched     gobuf......
}

panic结构体

从上述Goroutine结构体的定义,我们可以发现每一个Goroutine维护一个panic的链表,panic存储在栈上。

// _panic 保存了一个活跃的 panic 信息。// _panic 的值必须仅存在于栈上。// argp 和 link 字段是栈指针,但在栈增长时无需特殊处理:
// 由于它们是指针类型且 _panic 值仅存在于栈上,
// 常规的栈指针调整机制会自动处理这些字段。
type _panic struct {argp unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblinkarg  any            // argument to paniclink *_panic        // link to earlier panic// startPC and startSP track where _panic.start was called.startPC uintptrstartSP unsafe.Pointer// The current stack frame that we're running deferred calls for.sp unsafe.Pointerlr uintptrfp unsafe.Pointer// retpc stores the PC where the panic should jump back to, if the// function last returned by _panic.next() recovers the panic.retpc uintptr// Extra state for handling open-coded defers.deferBitsPtr *uint8slotsPtr     unsafe.Pointerrecovered   bool // whether this panic has been recoveredgoexit      booldeferreturn bool
}

注意事项

golang中每个goroutine维护自己的panic信息,并不是全局的,所以,如果需要捕获panic信息需要在每个goroutine中处理。

所以,在下面的这个案例中recover不能捕获到panic信息。如果需要捕获到,需要在每个协程中都执行recover的逻辑。

func main() {defer func() {if r := recover(); r != nil {log.Printf("Recovered from panic: %v", r)os.Exit(1)}}()// 业务代码...go func() {testPanic()}()time.Sleep(1 * time.Second)
}

http://www.15wanjia.com/news/19734.html

相关文章:

  • 如何做二维码跳转到网站软文标题例子
  • 网站定制开发怎么做百度seo关键词排名优化软件
  • 秦皇岛网站制作价格推广恶意点击软件怎样使用
  • 网站app简单做抄一则新闻四年级
  • 阿里云成功备案的网站增加域名临沂seo公司稳健火星
  • 真人做的免费视频网站自己怎么做关键词优化
  • 邹平做网站哪家好seo快速排名源码
  • 安徽网站排名类似火脉的推广平台
  • 做网站如何赢利的seo站点
  • 怎样不让网站被收录扬州seo博客
  • 做威客有什么靠谱网站百度快速排名优化工具
  • 网站开发要什么基础奶茶网络营销策划方案
  • 常见b2c网站有哪些站长工具app
  • 昆明哪些做网站建设的公司上海b2b网络推广外包
  • 有没有做淘宝客网站的搜索引擎网站大全
  • 北京网站设计公司哪家公司好线下广告投放渠道都有哪些
  • 做网站怎么提取视频无广告免费b站推广网站在线
  • 方案 网站广州婚恋网站排名
  • 网站备案流程详细百度6大核心部门
  • 做网站哪家公司好苏州网络营销推广渠道有哪些
  • 哪个网站可以做行程温州企业网站排名优化
  • 淮安做微信网站自动秒收录网
  • 电子商城网站开发多少钱公司网址怎么制作
  • 定制家具价格seocui cn
  • 写作的网站有哪些企业推广平台排行榜
  • 做一个中型网站需要多少钱营销渠道策略
  • iis网站重定向昆明网络推广公司排名
  • wordpress栏目标题被调用郑州seo技术服务
  • 网站应该怎么做运维小吃培训机构排名前十
  • 百度云怎么做网站空间站长统计 站长统计