当声明一个final成员时,必须在构造函数退出前设置它的值 final类型的成员变量的值,包括那些用final引用指向的collections的对象,是读线程安全而无需使用synchronization的 1,恶汉 线程安全 效率低 2,饱汉 线程安全 效率低 3,synchronized放到方法内 ...
分类:
其他好文 时间:
2020-06-14 20:29:54
阅读次数:
45
During my time with Zotero, I've really enjoyed its various features and the 300MB of file sync space is able to be extended by modifying the path to ...
用channel实现一个消息传递,需求如下: //启动一个goroutine,生成100个数发送到ch1//启动一个goroutine,从ch1取值,计算它的平方放到ch2中//再main中,从ch2打印出来直接贴最后代码。 var wg sync.WaitGroup func main(){ wg ...
分类:
其他好文 时间:
2020-06-14 01:31:40
阅读次数:
85
模板机,交换机,lan区段,read 2. ssh scp rsync的三种传输方式 rsync+cron 3. rsync+inotify NFS 4. rsync和NFS排错 sersync 5. ssh telnet 环境变量与命令 ifconfig、ifup、ifdown ssh免密登录 跳 ...
分类:
其他好文 时间:
2020-06-14 01:22:53
阅读次数:
84
环境 主机名 安装服务 wan lan db01 mariadb 10.0.0.51 172.16.1.51 流程分析 1.安装ansible 2.优化ansible 3.推送公钥 4.开启防火墙 5.开启80 443 873 nfs等端口和服务白名单 6.关闭selinux 7.创建同一的用户 1 ...
分类:
数据库 时间:
2020-06-14 01:09:54
阅读次数:
112
题意:你有$a$个树枝和$b$个钻石,$2$个树枝和$1$个钻石能造一个铁铲,$1$个树枝和$2$个钻石能造一把剑,问最多能造多少铲子和剑. 题解:如果$a\le b$,若$b\ge 2a$,那么一直取$b$即可,否则就要两两轮流减,即$(a+b)/3$,取个min即可. 代码: #include ...
分类:
其他好文 时间:
2020-06-12 20:12:15
阅读次数:
62
all goroutines are asleep - deadlock 简单使用: package main import ( "sync" ) type httpPkg struct{} func (httpPkg) Get(url string) {} var http httpPkg fun ...
分类:
其他好文 时间:
2020-06-12 14:57:50
阅读次数:
82
package mainimport ( "fmt" "sync")func say(i int ,wg *sync.WaitGroup) { defer wg.Done() fmt.Println(i)}func main() { var wg sync.WaitGroup for i:=0;i< ...
分类:
其他好文 时间:
2020-06-12 14:17:51
阅读次数:
43
一、什么是异步? 所谓"异步",简单说就是一个任务分成两段,先执行第一段,然后转而执行其他任务,等做好了准备,再回过头执行第二段。比如,有一个任务是读取文件进行处理,异步的执行过程就是下面这样。 上图中,任务的第一段是向操作系统发出请求,要求读取文件。然后,程序执行其他任务,等到操作系统返回文件,再 ...
分类:
其他好文 时间:
2020-06-12 11:01:56
阅读次数:
61
alert.log日志报了如下的错误: 1 Fri Oct 17 19:59:51 2014 2 Thread 1 cannot allocate new log, sequence 4722 3 Private strand flush not complete 4 Current log# 1 ...
分类:
其他好文 时间:
2020-06-11 21:59:44
阅读次数:
55