Linux 相关笔记记录1
来源:互联网 发布:北京国税开票软件下载 编辑:程序博客网 时间:2024/06/05 15:01
C++11/C++14 7. Threads with Shared Memory and Mutex - 2017
[IPC:Shared Memory]
int shmget(key_t key, size_t size, int shmflg);
int shmctl(int shmid, int cmd, struct shmid_ds *buf);
void *shmat(int shmid, const void *shmaddr, int shmflg);int shmdt(const void *shmaddr);
getsockopt, setsockopt
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
TCP option SO_LINGER (zero) - when it’s required
The typical reason to set a
SO_LINGER
timeout of zero is to avoid large numbers of connections sitting in theTIME_WAIT
state, tying up all the available resources on a server.2、若设置了SO_LINGER并确定了非零的超时间隔,则closesocket()调用阻塞进程,直到所剩数据发送完毕或超时。这种关闭称为“优雅”或“从容”关闭。请注意如果套接口置为非阻塞且SO_LINGER设为非零超时,则closesocket()调用将以WSAEWOULDBLOCK错误返回。
epoll_wait()
epoll_wait, epoll_pwait - wait for an I/O event on an epoll file descriptor.#include <sys/epoll.h>int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);int epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask);
epoll
provides both edge-triggered and level-triggered modes. In edge-triggered mode, a call toepoll_wait
will return only when a new event is enqueued with theepoll
object, while in level-triggered mode,epoll_wait
will return as long as the condition holds.For instance, if a pipe registered with
epoll
has received data, a call toepoll_wait
will return, signaling the presence of data to be read. Suppose the reader only consumed part of data from the buffer. In level-triggered mode, further calls toepoll_wait
will return immediately, as long as the pipe’s buffer contains data to be read. In edge-triggered mode, however,epoll_wait
will return only once new data is written to the pipe.
epoll_ctl
epoll_ctl - control interface for an epoll file descriptor#include <sys/epoll.h>int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);
- Linux 相关笔记记录1
- Linux驱动学习相关记录笔记
- linux相关简单记录
- Linux相关命令记录
- Linux相关基础知识记录
- LINUX相关记录(20.13.1.22)
- Linux相关指命记录
- linux库文件相关记录
- Linux 系统相关知识记录
- linux相关的知识记录
- Linux笔记记录1 fork()
- linux 学习记录笔记
- Linux学习笔记记录
- Linux信号相关笔记
- linux相关笔记
- Linux相关笔记
- ElasticSearch学习笔记-相关度得分记录
- linux进程调度相关问题记录
- effective C++条款二十四解读
- shell编程中常用的单目运算
- LVS-DR实现web调度模式
- css(div水平垂直居中)
- 数字证书原理
- Linux 相关笔记记录1
- Visa学习
- 网易2017春招笔试编程题 分饼干
- 使用统计学习计算选出所有牌有效且没有无效牌的概率
- 洛谷 P2668 斗地主
- 按量付费实例批量更改实例带宽
- 什么是二维数组
- NIO 之 Channel实现原理
- C# WinForm中的提示