KiActivateWaiterQueue函数和Queue->Header.WaitListHead队列等待列表的关系

   
 

第一部分:
            if (Thread->ApcState.KernelApcPending &&
                (Thread->SpecialApcDisable == 0) &&
                (Thread->WaitIrql < APC_LEVEL)) {

            } else {


                //
                // Insert wait block in object wait list.
                //

                InsertTailList(&Queue->Header.WaitListHead, &WaitBlock->WaitListEntry);


VOID
FORCEINLINE
InsertTailList(
    IN PLIST_ENTRY ListHead,
    IN PLIST_ENTRY Entry
    )
{
    PLIST_ENTRY Blink;

    Blink = ListHead->Blink;
    Entry->Flink = ListHead;
    Entry->Blink = Blink;
    Blink->Flink = Entry;
    ListHead->Blink = Entry;
}

//LIFO队列


第二部分:


NTSTATUS
KeDelayExecutionThread (
    IN KPROCESSOR_MODE WaitMode,
    IN BOOLEAN Alertable,
    IN PLARGE_INTEGER Interval
    )
{


            //
            // If the current thread is processing a queue entry, then attempt
            // to activate another thread that is blocked on the queue object.
            //

            Queue = Thread->Queue;
            if (Queue != NULL) {
                KiActivateWaiterQueue(Queue);
            }


NTSTATUS
KeWaitForMultipleObjects (
    IN ULONG Count,
    IN PVOID Object[],
    IN WAIT_TYPE WaitType,
    IN KWAIT_REASON WaitReason,
    IN KPROCESSOR_MODE WaitMode,
    IN BOOLEAN Alertable,
    IN PLARGE_INTEGER Timeout OPTIONAL,
    IN PKWAIT_BLOCK WaitBlockArray OPTIONAL
    )
{
            //
            // If the current thread is processing a queue entry, then attempt
            // to activate another thread that is blocked on the queue object.
            //

            Queue = Thread->Queue;
            if (Queue != NULL) {
                KiActivateWaiterQueue(Queue);
            }

NTSTATUS
KeWaitForSingleObject (
    IN PVOID Object,
    IN KWAIT_REASON WaitReason,
    IN KPROCESSOR_MODE WaitMode,
    IN BOOLEAN Alertable,
    IN PLARGE_INTEGER Timeout OPTIONAL
    )
{
              //
            // If the current thread is processing a queue entry, then attempt
            // to activate another thread that is blocked on the queue object.
            //

            Queue = Thread->Queue;
            if (Queue != NULL) {
                KiActivateWaiterQueue(Queue);
            }

第三部分:

FORCEINLINE
VOID
KiActivateWaiterQueue (
    IN PRKQUEUE Queue
    )

/*++

Routine Description:

    This function is called when the current thread is about to enter a
    wait state and is currently processing a queue entry. The current
    number of threads processign entries for the queue is decrement and
    an attempt is made to activate another thread if the current count
    is less than the maximum count, there is a waiting thread, and the
    queue is not empty.

    N.B. It is possible that this function is called on one processor
         holding the dispatcher database lock while the state of the
         specified queue object is being modified on another processor
         while holding only the queue object lock. This does not cause
         a problem since holding the queue object lock ensures that
         there are no waiting threads.

Arguments:

    Queue - Supplies a pointer to a dispatcher object of type event.

Return Value:

    None.

--*/

{

    PRLIST_ENTRY Entry;
    PRKTHREAD Thread;
    PRKWAIT_BLOCK WaitBlock;
    PRLIST_ENTRY WaitEntry;

    //
    // Decrement the current count of active threads and check if another
    // thread can be activated. If the current number of active threads is
    // less than the target maximum number of threads, there is a entry in
    // in the queue, and a thread is waiting, then remove the entry from the
    // queue, decrement the number of entries in the queue, and unwait the
    // respectiive thread.
    //

    Queue->CurrentCount -= 1;
    if (Queue->CurrentCount < Queue->MaximumCount) {
        Entry = Queue->EntryListHead.Flink;
        WaitEntry = Queue->Header.WaitListHead.Blink;//LIFO队列
        if ((Entry != &Queue->EntryListHead) &&
            (WaitEntry != &Queue->Header.WaitListHead)) {

            RemoveEntryList(Entry);
            Entry->Flink = NULL;
            Queue->Header.SignalState -= 1;
            WaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
            Thread = WaitBlock->Thread;
            KiUnwaitThread(Thread, (LONG_PTR)Entry, 0);
        }
    }

    return;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/76466.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

让DeepSeek API支持联网搜索

引子 DeepSeek官网注册的API token是不支持联网搜索的&#xff0c;这导致它无法辅助分析一些最新的情况或是帮忙查一下互联网上的资料。本文从实战角度提供一种稳定可靠的方法使得DeepSeek R1支持联网搜索分析。 正文 首先登录火山方舟控制台&#xff0c;https://www.volcen…

生物信息Rust-01

前言-为什么想学Rust&#xff1f; 一直想多学一门编译语言&#xff0c;主要有几个原因吧&#xff08;1. 看到一位老师实验室要求需要掌握一门编译语言&#xff1b;2. 自己享想试着开发一些实用的生信工具&#xff0c;感觉自己现在相比于数据分析&#xff0c;探索生物学层面的意…

字符串与相应函数(上)

字符串处理函数分类 求字符串长度&#xff1a;strlen长度不受限制的字符串函数&#xff1a;strcpy,strcat,strcmp长度受限制的字符串函数:strncpy,strncat,strncmp字符串查找&#xff1a;strstr,strtok错误信息报告&#xff1a;strerror字符操作&#xff0c;内存操作函数&…

asm汇编源代码之文件操作相关

提供7个子程序:   1. 关闭文件 FCLOSE   2. 打开文件 FOPEN   3. 文件大小 FSIZE   4. 读文件 FREAD   5. 写文件 FWRITE   6. 建立文件 FCREATE   7. 读取或设置文件指针 FPOS 具体功能及参数描述如下 ; ---------------------------- FCLOSE PROC  FAR ; IN…

[Dify] 使用 Docker 本地部署 Dify 并集成 Ollama 模型的详细指南

在 AI 应用快速发展的今天&#xff0c;开源项目如 Dify 正成为构建本地化 AI 应用的利器。通过 Dify&#xff0c;你可以轻松地集成不同的大语言模型&#xff08;LLM&#xff09;&#xff0c;如 Ollama&#xff0c;并快速创建可交互的 AI 应用。本篇文章将带你一步步通过 Docker…

Spring Boot 测试详解,包含maven引入依赖、测试业务层类、REST风格测试和Mock测试

Spring Boot 测试详解 1. 测试依赖引入 Spring Boot 默认通过以下 Maven 依赖引入测试工具&#xff1a; <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</s…

DevOps与功能安全:Perforce ALM通过ISO 26262合规认证,简化安全关键系统开发流程

本文来源perforce.com&#xff0c;由Perforce中国授权合作伙伴、DevSecOps解决方案提供商-龙智翻译整理。 近日&#xff0c;Perforce ALM&#xff08;原Helix ALM&#xff09;通过了国际权威认证机构 TV SD的ISO 26262功能安全流程认证&#xff01;该认证涵盖Perforce ALM解决方…

Android11车载WiFi热点默认名称及密码配置

一、背景 基于车厂信息安全要求,车载热点默认名称不能使用统一的名称,以及默认密码不能为简单的1~9。 基于旧项目经验,组装工厂自动化测试及客户整车组装的时候均存在多台设备同时打开,亦不太推荐使用统一的热点名称,连接无法区分。 二、需求 根据客户的要求,默认名称…

MacOs java环境配置+maven环境配置踩坑实录

oracl官网下载jdk 1.8的安装包 注意可能需要注册&#xff01;&#xff01;&#xff01; 下载链接&#xff1a;下载地址点击 注意晚上就不要下载了 报错400 &#xff01;&#xff01;&#xff01; 1.点击安装嘛 2.配置环境变量 export JAVA_HOME/Library/Java/Java…

如何解读 /proc/net/netstat

在刷了屏的川普&#xff0c;关税&#xff0c;AI 大模型和 RDMA 之外的一股清流&#xff0c;来点实用的。 众所周知 /proc/net/netstat 很难读&#xff0c;且 netstat 并不是每个系统上都支持 -s&#xff0c;那么对齐该文件给出一个可读的输出就是一件高尚的事。可以用 column …

汉化进度100%

P3834 #include<bits/stdc.h> #define int long long #define 定义整型变量 int #define 这是一个常量 const #define 无返回值函数 void #define 这是一个循环条件在后面 for #define 定义结构体 struct #define 如果 if #define 否则 else #define 定义无返回值的 sig…

基于SpringBoot的动物救助中心系统(源码+数据库)

500基于SpringBoot的动物救助中心系统&#xff0c;本系统共分为2个角色&#xff1a;系统管理员、用户&#xff0c;主要功能如下 【管理员】&#xff1a; 1. 登录&#xff1a;管理员可以通过登录系统来管理各种功能。 2. 用户管理&#xff1a;管理员可以查看用户列表&#xff0…

rockylinux 8 9 升级到指定版本

rockylinux 8 update 指定版本 rockylinux 历史版 所有版本rockylinux 最新版 所有版本vault历史版 pub最新版(https://dl.rockylinux.org)地址后面增加不同名称 echo "delete repos" rm -rf /etc/yum.repos.d/*echo "new rockylinux repo" cat <<EO…

聚焦AI与大模型创新,紫光云如何引领云计算行业快速演进?

【全球云观察 &#xff5c; 科技热点关注】 随着近年来AI与大模型的兴起&#xff0c;云计算行业正在发生着一场大变局。 “在2025年春节期间&#xff0c;DeepSeek两周火爆全球&#xff0c;如何进行私域部署成了企业关心的问题。”紫光云公司总裁王燕平强调指出&#xff0c;AI与…

React8+taro开发微信小程序,实现lottie动画

安装核心依赖 npm install lottie-miniprogram tarojs/plugin-html --save修改 Taro 配置 (config/index.js) const config {plugins: [tarojs/plugin-html,// 其他插件...],mini: {canvas: true,webpackChain(chain) {chain.merge({module: {rule: {lottie-loader: {test: …

有效压缩 Hyper-v linux Centos 的虚拟磁盘 VHDX

参考&#xff1a; http://www.360doc.com/content/22/0505/16/67252277_1029878535.shtml VHDX 有个不好的问题就是&#xff0c;如果在里面存放过文件再删除&#xff0c;那么已经使用过的空间不会压缩&#xff0c;导致空间一直被占用。那么就需要想办法压缩空间。 还有一点&a…

【力扣hot100题】(089)最长有效括号

这题目真是越做越难了。 但其实只是思路很难想到&#xff0c;一旦会了方法就很好做。 但问题就在方法太难想了…… 思路还是只要遍历一遍数组&#xff0c;维护动态规划数组记录截止至目前位置选取该元素的情况下有效括号的最大值。 光是知道这个还不够&#xff0c;看了答案…

Ajax------免刷新地前后端交互

本文略带PHP代码需要在PHP环境下使用 介绍 AJAX (Asynchronous JavaScript and XML) 是一种创建快速动态网页应用的开发技术&#xff0c;它允许网页在不重新加载整个页面的情况下&#xff0c;与服务器交换数据并更新部分网页内容。例如&#xff0c;在我们做爬虫的时候发现有些…

Android 中支持旧版 API 的方法(API 30)

Android 中最新依赖库的版本支持 API 31 及以上版本&#xff0c;若要支持 API30&#xff0c;则对应的依赖库的版本就需要使用旧版本。 可通过修改模块级 build.gradle 文件来进行适配。 1、android 标签的 targetSdk 和 compileSdk 版本号 根据实际目标设备的 android 版本来…

JDBC注入无外网(上):从HertzBeat聊聊SnakeYAML反序列化

上周日联合Ar3h 师傅一起&#xff0c;在【代码审计知识星球】里发布了一个Springboot的小挑战&#xff1a;https://t.zsxq.com/tSBBZ&#xff0c;这个小挑战的核心目标是在无法连接外网的情况下&#xff0c;如何利用PSQL JDBC注入漏洞。我会分两篇文章来讲讲Java安全的不出网利…