delphi中thread的handle和threadid的区别
答案:2 悬赏:30 手机版
解决时间 2021-04-04 22:02
- 提问者网友:缘字诀
- 2021-04-04 12:59
delphi中thread的handle和threadid的区别
最佳答案
- 五星知识达人网友:持酒劝斜阳
- 2021-04-04 13:52
谈下个人的理解:
id 是对象的标志号,是用来区别同类别的不同个体。
handle 是句柄,是系统实时分配的资源,可以将句柄看作是处理对象的一个接口,可以通过句柄去进行操作。
两者最大的区别在于,可以直接通过系统实时分配给 thread 的 handle 来对 thread 获取权限,对 thread 进行实际的操作(比如:终止进程等),而通常不能通过 id 来进行这种操作。
id 是对象的标志号,是用来区别同类别的不同个体。
handle 是句柄,是系统实时分配的资源,可以将句柄看作是处理对象的一个接口,可以通过句柄去进行操作。
两者最大的区别在于,可以直接通过系统实时分配给 thread 的 handle 来对 thread 获取权限,对 thread 进行实际的操作(比如:终止进程等),而通常不能通过 id 来进行这种操作。
全部回答
- 1楼网友:低血压的长颈鹿
- 2021-04-04 14:31
msdn中写道:the win32 api does not provide a way to get the thread handle from the thread identifier. if the handles were made available this way, the owning process could fail because another process unexpectedly performed an operation on one of its threads, such as suspending it, resuming it, adjusting its priority, or terminating it. instead, you must request the handle from the thread creator or the thread itself. 看来是弗成以了。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯