第四章 通知链
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 通知链是一份函数列表,当给定事件发生时予以执行。列表中的每个函数都让另一个子系统知道,调用此函数的子系统内所发生的一个事件或子系统所侦测到个一个事件。 通知链使用发布-订阅(publish-and-subcribe)模型: 被通知者 ——接收某事件的子系统,提供回调函数予以调用 通知者 ——感受到一个事件并调用回呼函数的子系统 通知 通知链列表元素的类型是notifier_block,定义: /* * notifier_call 要执行的函数 * next 链接列表的元素 * priority 优先级 */ struct notifier_block{ int (*notifier_call)(struct notifier_block *self, unsigned long, void *); struct notifier_block *next; int priority; } 网络子系统通知链: inetaddr_chain ——发送有关本地接口上的IPv4地址的插入、删除以及变更的通知信息 inet6addr_chain —— 发送有关本地接口上的IPv6地址的插入、删除以及变更的通知信息 netdev_chain —— 发送有关网络设备注册状态的通知信息 /*struct nofitier