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

怎么做音乐mp3下载网站销售找客户最好的app

怎么做音乐mp3下载网站,销售找客户最好的app,网站如何和其他网站做友情链接,做网站怎样盈利derfer : 延迟调用,函数结束返回时执行,多个defer按照先进后出的顺序调用 原理:底层通过链表实现,每次新增的defer调用,通过头插法插入链表;defer执行时,从链表头开始遍历,相当于实…

derfer : 延迟调用,函数结束返回时执行,多个defer按照先进后出的顺序调用

原理:底层通过链表实现,每次新增的defer调用,通过头插法插入链表;defer执行时,从链表头开始遍历,相当于实现了后加入的defer先执行,先加的defer后执行

defer结构体

type _defer struct {started boolheap    bool// openDefer indicates that this _defer is for a frame with open-coded// defers. We have only one defer record for the entire frame (which may// currently have 0, 1, or more defers active).openDefer boolsp        uintptr // sp at time of deferpc        uintptr // pc at time of deferfn        func()  // can be nil for open-coded defers_panic    *_panic // panic that is running deferlink      *_defer // next defer on G; can point to either heap or stack!// If openDefer is true, the fields below record values about the stack// frame and associated function that has the open-coded defer(s). sp// above will be the sp for the frame, and pc will be address of the// deferreturn call in the function.fd   unsafe.Pointer // funcdata for the function associated with the framevarp uintptr        // value of varp for the stack frame// framepc is the current pc associated with the stack frame. Together,// with sp above (which is the sp associated with the stack frame),// framepc/sp can be used as pc/sp pair to continue a stack trace via// gentraceback().framepc uintptr
}

defer初始化

// Create a new deferred function fn, which has no arguments and results.
// The compiler turns a defer statement into a call to this.
func deferproc(fn func()) {gp := getg()if gp.m.curg != gp {// go code on the system stack can't deferthrow("defer on system stack")}d := newdefer()if d._panic != nil {throw("deferproc: d.panic != nil after newdefer")}// 这里使用头插法 插入链表d.link = gp._defergp._defer = dd.fn = fnd.pc = getcallerpc()// We must not be preempted between calling getcallersp and// storing it to d.sp because getcallersp's result is a// uintptr stack pointer.d.sp = getcallersp()// deferproc returns 0 normally.// a deferred func that stops a panic// makes the deferproc return 1.// the code the compiler generates always// checks the return value and jumps to the// end of the function if deferproc returns != 0.return0()// No code can go here - the C return register has// been set and must not be clobbered.
}

defer执行

func deferreturn() {gp := getg()for {d := gp._deferif d == nil {return}sp := getcallersp()if d.sp != sp {return}if d.openDefer {done := runOpenDeferFrame(gp, d)if !done {throw("unfinished open-coded defers in deferreturn")}gp._defer = d.linkfreedefer(d)// If this frame uses open defers, then this// must be the only defer record for the// frame, so we can just return.return}fn := d.fnd.fn = nil// 指向下一个defer节点gp._defer = d.linkfreedefer(d)fn()}
}
http://www.dinnco.com/news/85307.html

相关文章:

  • 网站首页建设公司百度收录网站提交入口
  • 10个国内建筑网站环球军事网最新军事新闻最新消息
  • 网站建设 团队介绍真实有效的优化排名
  • 电子商务网站建设的概要设计最新新闻热点事件摘抄
  • 做的比较好的美食网站推广图片制作
  • 会昌县 两学一做 网站互联网营销推广怎么做
  • 项目计划书团队介绍seo机构
  • 珠海市 网站建设软文写作的基本要求
  • 做视频的网站那几个盈利了百度指数可以查询到哪些内容
  • 做照片模板下载网站爱站长
  • 网站公告栏设计免费发布广告
  • 用dw做的企业网站浏览器下载安装2022最新版
  • 曲靖做网站公司网站免费下载安装
  • 专门做外贸机械的网站就业seo好还是sem
  • 哪个网站做推广效果好湖南优化电商服务有限公司
  • 谎称在赌博网站做维护推广运营平台
  • 运营者邮箱怎么注册抖音seo
  • 长辛店网站建设哈尔滨百度网络推广
  • 做婚介打么网站好什么是淘宝seo
  • 自己做的网站怎么样把里面的内容下载下来注册网站平台要多少钱
  • 网站建设科技有限公司网上销售平台
  • 网站加入收藏电商是做什么的
  • 闵行广州网站建设广州网络营销的推广
  • wordpress 调用jsseo整站优化更能准确获得客户
  • 兰州网站建设开发深圳整站seo
  • 山东丽天建设集团网站扬州seo推广
  • 手机视频网站建设小红书搜索指数
  • 遵义网站制作外包惠州网站营销推广
  • wordpress供应商管理系统seo教程技术优化搜索引擎
  • 网站营销推广策划方案seo每日