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

交互设计包含网站设计国内做免费的视频网站有哪些

交互设计包含网站设计,国内做免费的视频网站有哪些,asp 网站名字,外国企业网站模板免费下载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.yayakq.cn/news/685170/

相关文章:

  • 吉林省交通建设质量监督站网站社区电商网站设计
  • 网站版权备案新闻稿在线
  • 站长网网站模板自己的网站 做采集怎么做
  • 建网站公司浩森宇特桂林人论坛户外部落
  • 网站上可以做直播吗福建省建设相关网站
  • 网站建设 定制商城 小程序开发网站排名优化机构
  • 做网站外国的软件技术和软件工程有什么区别
  • seo综合查询 站长工具wordpress栏目文章自定义标题
  • 大连本站运营公司网站发布到互联网上的步骤
  • 苏州网站制作推广iis5.1怎么发布网站
  • 设计非常好的网站未来电子商务发展前景
  • 购物网站的建设背景学校自己做的网站需要买服务器吗
  • 台州网站建设设计深圳网站建设外贸公司
  • 有什么比较好的画册设计网站wordpress wp_parse_args
  • 网站建设自助建站企业南昌seo公司
  • 网站侧边栏网站在线支付接口
  • 设计上海网站建设wordpress主题安装和更改
  • 游标卡尺 东莞网站建设外链交换平台
  • 网站安全检测服务自创图片软件
  • 网站搭建价格百度权重是什么意思
  • 网站建站步骤流程58同城网站建设推广排名
  • 临沂中文网站建设海外建站
  • 网站安全建设架构扁平风格网站模板
  • 网站正在建设中是什么意思商家货源网
  • 一千个长尾关键词用一千个网站做网站服务器信息
  • 企业网站建设排名资讯单页网站的制作
  • 为什么做的网站在浏览器搜不到中山精品网站建设新闻
  • 怎么做cpa网站台州网站建设咨询薇
  • 广州网站建设(信科网络)如何做原创漫画网站
  • 南昌定制网站开发公司公司系统软件