摘要: Golang 反射 基本介绍 注意通过指针变量获取的变量是地址 //指针变量的kind fmt.Printf("%v\n", reflect.TypeOf(&student).Kind()) //ptr //指针变量的 type fmt.Printf("%T\n", &student) //*mai 阅读全文
posted @ 2020-08-15 23:49 CyberPelican 阅读(115) 评论(0) 推荐(0) 编辑
摘要: Golang 常量 参考: https://www.cnblogs.com/chenbaoding/p/12197244.html https://www.jianshu.com/p/08d6a4216e96 定义 const identifier type 不能将一个变量赋值给常量 Go中没有常量 阅读全文
posted @ 2020-08-15 17:14 CyberPelican 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 深入理解CAS算法原理 转载: https://www.jianshu.com/p/21be831e851e 1、什么是CAS? CAS:Compare and Swap,即比较再交换。 jdk5增加了并发包java.util.concurrent.*,其下面的类使用CAS算法实现了区别于synch 阅读全文
posted @ 2020-08-15 12:06 CyberPelican 阅读(311) 评论(0) 推荐(0) 编辑
摘要: Golang Channel 定义 channel本质是队列 线程安全, 多goroutine访问时, 不需要加锁,就是说channel本身线程安全 channel有类型,一个string的channel只能存放string 声明 var identifier chan type channel是引 阅读全文
posted @ 2020-08-15 00:43 CyberPelican 阅读(143) 评论(0) 推荐(0) 编辑