目录译者序 ....................................................................................................................................................IX前言.........................................................................................................................................................XI第 1 章 并发编程概述 .......................................................................................................................11.1 并发编程简介.............................................................................................................................11.2 异步编程简介 .............................................................................................................................31.3 并行编程简介 .............................................................................................................................71.4 响应式编程简介.........................................................................................................................91.5 数据流简介 ...............................................................................................................................111.6 多线程编程简介 .......................................................................................................................131.7 并发编程的集合.......................................................................................................................131.8 现代设计 ...................................................................................................................................141.9 技术要点总结 ...........................................................................................................................14第 2 章 异步编程基础 .....................................................................................................................172.1 暂停一段时间 ...........................................................................................................................182.2 返回完成的任务 .......................................................................................................................192.3 报告进度...................................................................................................................................212.4 等待一组任务完成 ...................................................................................................................222.5 等待任意一个任务完成 ...........................................................................................................252.6 任务完成时的处理...................................................................................................................262.7 避免上下文延续 .......................................................................................................................292.8 处理 async Task 方法的异常 ..................................................................................................302.9 处理 async void 方法的异常 ..................................................................................................32VI | 目录第 3 章 并行开发的基础 ................................................................................................................353.1 数据的并行处理 .......................................................................................................................353.2 并行聚合 ...................................................................................................................................373.3 并行调用...................................................................................................................................383.4 动态并行 ...................................................................................................................................403.5 并行 LINQ ................................................................................................................................41第 4 章 数据流基础 .........................................................................................................................434.1 链接数据流块 ...........................................................................................................................444.2 传递出错信息 ...........................................................................................................................454.3 断开链接...................................................................................................................................474.4 限制流量 ...................................................................................................................................484.5 数据流块的并行处理 ...............................................................................................................484.6 创建自定义数据流块...............................................................................................................49第 5 章 Rx 基础 ................................................................................................................................515.1 转换 .NET 事件 ........................................................................................................................525.2 发通知给上下文.......................................................................................................................545.3 用窗口和缓冲对事件分组 .......................................................................................................565.4 用限流和抽样抑制事件流 .......................................................................................................585.5 超时...........................................................................................................................................60第 6 章 测试技巧 ..............................................................................................................................636.1 async 方法的单元测试 ............................................................................................................646.2 预计失败的 async 方法的单元测试 .......................................................................................656.3 async void 方法的单元测试 ...................................................................................................676.4 数据流网格的单元测试 ...........................................................................................................686.5 Rx Observable 对象的单元测试..............................................................................................706.6 用虚拟时间测试 Rx Observable 对象 .....................................................................................72第 7 章 互操作 ..................................................................................................................................757.1 用 async 代码封装 Async 方法与 Completed 事件 ................................................................757.2 用 async 代码封装 Begin/End 方法 ........................................................................................777.3 用 async 代码封装所有异步操作 ...........................................................................................787.4 用 async 代码封装并行代码 ...................................................................................................807.5 用 async 代码封装 Rx Observable 对象 .................................................................................807.6 用 Rx Observable 对象封装 async 代码 .................................................................................827.7 Rx Observable 对象和数据流网格 ..........................................................................................83目录 | VII第 8 章 集合 .......................................................................................................................................858.1 不可变栈和队列 .......................................................................................................................878.2 不可变列表 ...............................................................................................................................898.3 不可变 Set 集合........................................................................................................................918.4 不可变字典 ...............................................................................................................................938.5 线程安全字典 ...........................................................................................................................948.6 阻塞队列...................................................................................................................................968.7 阻塞栈和包 ...............................................................................................................................998.8 异步队列 .................................................................................................................................1008.9 异步栈和包.............................................................................................................................1028.10 阻塞 / 异步队列 ....................................................................................................................104第 9 章 取消 .....................................................................................................................................1099.1 发出取消请求.........................................................................................................................1109.2 通过轮询响应取消请求 .........................................................................................................1129.3 超时后取消 .............................................................................................................................1149.4 取消 async 代码 .....................................................................................................................1159.5 取消并行代码 .........................................................................................................................1169.6 取消响应式代码 .....................................................................................................................1179.7 取消数据流网格.....................................................................................................................1199.8 注入取消请求 .........................................................................................................................1209.9 与其他取消体系的互操作 .....................................................................................................122第 10 章 函数式 OOP ...................................................................................................................12510.1 异步接口和继承 ...................................................................................................................12510.2 异步构造:工厂 ...................................................................................................................12710.3 异步构造:异步初始化模式...............................................................................................12910.4 异步属性 ...............................................................................................................................13210.5 异步事件 ...............................................................................................................................13410.6 异步销毁...............................................................................................................................137第 11 章 同步 ..................................................................................................................................14311.1 阻塞锁 ...................................................................................................................................14811.2 异步锁...................................................................................................................................14911.3 阻塞信号 ...............................................................................................................................15111.4 异步信号 ...............................................................................................................................15211.5 限流.......................................................................................................................................154VIII | 目录第 12 章 调度 ..................................................................................................................................15712.1 调度到线程池 .......................................................................................................................15712.2 任务调度器 ...........................................................................................................................15912.3 调度并行代码.......................................................................................................................16112.4 用调度器实现数据流的同步 ...............................................................................................161第 13 章 实用技巧 .........................................................................................................................16313.1 初始化共享资源...................................................................................................................16313.2 Rx 延迟求值 .........................................................................................................................16513.3 异步数据绑定 .......................................................................................................................16613.4 隐式状态...............................................................................................................................168封面介绍 ..............................................................................................................................................170
评论