Go Context原理及其典型适用场景Context原理及其适用场景 随手记 李帅(飞雪无情) n 常见并发模式 n Context实现原理 n TLS VS Context n 典型适用场景 大纲 Channel Fan-in func fanIn(sum1, sum2 <-chan int) <-chan int { sum := make(chan int) go func() { for {sum <- <-sum1} } } Context l 一个任务,需要多个goroutine完成 l 一个请求,会触发好多个goroutine做不同的事情 l 如果我们的任务终止了,请求取消了,这些正在运行 的goroutine怎么办? l 使用Context来简化这些操作 Context能做什么 u 手动、定时、超时发出取消信号 u 跨API传值 u 控制生成Context树结构(Context链) Context main() { rootCtx := context.Background() ctx, cancel := context.WithCancel(rootCtx) go watch(ctx) go watch(ctx) time.Sleep(1 * time.Second) cancel() } func watch(ctx context.Context) { for { select {0 码力 | 32 页 | 4.62 MB | 1 年前3
httpd 2.4.25 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2573 页 | 2.12 MB | 1 年前3
httpd 2.4.23 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2559 页 | 2.11 MB | 1 年前3
httpd 2.4.20 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2533 页 | 2.09 MB | 1 年前3
httpd 2.4.18 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2467 页 | 1.89 MB | 1 年前3
httpd 2.2.31 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 1860 页 | 1.48 MB | 1 年前3
httpd 2.4.17 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2455 页 | 1.88 MB | 1 年前3
httpd 2.4.16 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 2438 页 | 1.87 MB | 1 年前3
httpd 2.2.29 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 1854 页 | 1.48 MB | 1 年前3
httpd 2.2.27 中文文档will start Apache as root. Before doing this ensure that your server is properly configured for security and access restrictions. The apachectl script is designed to act like a standard SysV init script; controlling process creation can only be placed in the main server context. To find which directives can be placed in which sections, check the Context of the directive. For further information, we provide details files take immediate effect. To find which directives can be placed in .htaccess files, check the Context of the directive. The server administrator further controls what directives may be placed in .htaccess0 码力 | 1849 页 | 1.47 MB | 1 年前3
共 542 条
- 1
- 2
- 3
- 4
- 5
- 6
- 55













