为什么我会使用 Sleep() 无限超时? [英] Why would I use Sleep() with infinite timeout?

查看:27
本文介绍了为什么我会使用 Sleep() 无限超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 MSDN,Sleep() 可以提供 INFINITE 值并且表示暂停不应超时".

According to MSDN, Sleep() can be provided INFINITE value and that "indicates that the suspension should not time out".

为什么我要在程序中使用 INFINITE 超时调用 Sleep()?

Why would I want to call Sleep() with INFINITE timeout in my program?

推荐答案

头脑清醒的人没有理由会睡(无限).没有实际意义.

There's no reasons one in his sane mind would ever Sleep(INFINITE). It has no practical meaning.

这是为了 WaitForSingleObject(..., timeout) 和 SleepEx(timeout) 的通用性和对称性,其中 INFINITE 确实有意义.

It is for generality and symmetry to WaitForSingleObject(..., timeout) and SleepEx(timeout), where INFINITE does make sense.

提醒,SleepEx 将尝试消耗线程 APC 队列中的内容.

Reminding, that SleepEx will try to consume things out of your thread's APC queue.

这篇关于为什么我会使用 Sleep() 无限超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆