怎么安全的移除完成端口的key
来源:互联网 发布:网络赌搏 编辑:程序博客网 时间:2024/04/29 23:48
Usually, these are two ways to safe release resource associated with
IOCP.
The first is using refcounting. When issuing a WSARecv/WSASend,
increase
refcount. When GetQueuedCompletionStatus return, decrease refcount.
It is safe to release resouece when refcount is zero.
The second is using a hashtable. For example, pass SocketHandle to
CreateIoCompletionPort as the completion key, and push the pair --
(SocketHandle, Session) -- into hashtable. When
GetQueuedCompletionStatus
return, get the session from the hashtable by the SocketHandle.
When it need to release the session, remove the pair from the
hashtable first.
After that, when GetQueuedCompletionStatus return, it cannot get the
session
IOCP.
The first is using refcounting. When issuing a WSARecv/WSASend,
increase
refcount. When GetQueuedCompletionStatus return, decrease refcount.
It is safe to release resouece when refcount is zero.
The second is using a hashtable. For example, pass SocketHandle to
CreateIoCompletionPort as the completion key, and push the pair --
(SocketHandle, Session) -- into hashtable. When
GetQueuedCompletionStatus
return, get the session from the hashtable by the SocketHandle.
When it need to release the session, remove the pair from the
hashtable first.
After that, when GetQueuedCompletionStatus return, it cannot get the
session
from the hashtable any more.
http://alt.winsock.programming.narkive.com/68BFIguM/getqueuedcompletionstatus-when-it-s-safe-to-delete-the-completion-key
0 0
- 怎么安全的移除完成端口的key
- 什么是线程安全? 线程安全是怎么完成的(原理)?
- 【linux安全】移除不必要的服务
- AndEngine安全移除精灵的方式
- 完成端口的原理
- 完成端口的原理
- 完成端口的BUG?
- 完成端口的原理
- 完成端口的原理
- 完成端口的原理
- 完成端口的原理
- 完成端口的详解
- 怎么利用完成端口监听多个不同端口的socket
- 交换机的端口安全
- 卸载,弹出,安全移除驱动器 的区别
- 基于完成端口的HttpProxy
- 我理解的完成端口
- 完成端口的简单理解
- 内存池设计与实现
- JSch:纯JAVA实现SFTP文件上传和下载
- 使用jstack查看最耗CPU的java的线程
- c++第三次作业
- 用用程序缺少*.dll以及0xc000007b无法正常启动
- 怎么安全的移除完成端口的key
- 一些Codeforces的水题
- java泛型的一些研究
- Leetcode 8. String to Integer (atoi) The Solution of Python
- C++实验4——输出星号图
- “the import java.io cannot be resolved”错误的解决方法
- linux初级学习之进程 第七单元学习笔记
- [蓝桥杯]-年龄巧合
- <读书笔记--并发>二、java并发机制