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

怎么做音乐mp3下载网站免费sem工具

怎么做音乐mp3下载网站,免费sem工具,网站建设推广是什么意思,网站内容运营是什么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.mmbaike.com/news/46489.html

相关文章:

  • 河北省建设项目环境官网网站如何开发网站
  • 商城网站的主要模块指数函数和对数函数
  • 网站建设全过程及如何赚钱百度搜索下载安装
  • 糖粉怎么自己制作百度蜘蛛池自动收录seo
  • 易语言跳到指定网站怎么做楼市最新消息
  • 独立网站建设空间哪里买免费网站推广网站短视频
  • 3yx这个网站做刷单seo优化效果
  • wordpress整站cdn福州网站制作推广
  • 网站建设设计图图片如何制作网页链接
  • 可以免费做宣传的网站北京谷歌seo
  • 国家卫健委疫情最新消息seo优化多少钱
  • 赣州网站建设jx25交友平台
  • 公司网站建设岗位营销公司排名
  • 网站定制要花多少钱网站收录查询工具
  • 旅游交友的网站建设国外搜索引擎排名
  • 网站新闻打不开郑州网站关键词排名
  • 9377烈焰传奇手游官网旺道网站优化
  • 网页qq表情郑州seo服务公司
  • 易企秀网站开发语言怎么建个网站
  • 贵阳58同城做网站百度广告收费
  • 易思网站系统网址导航该如何推广
  • 今日国内新闻简讯武汉seo引擎优化
  • 微官网和手机网站一样吗收录查询站长工具
  • b2c网站开发多少钱美食软文300范例
  • google怎么做网站推广软文广告示范
  • 网站建设论坛华夏思源培训机构官网
  • 自己的电脑做网站可以吗市场营销策略
  • 委托网络公司做的网站侵权深圳seo优化排名
  • 网站素材资源百度信息流投放技巧
  • 微信网站开发平台如何拿高权重网站外链进行互换?