首页 \ 问答 \ 当epoll可用时,epoll会完全取代select / poll吗?(could epoll totally replace select/poll when it is available?)

当epoll可用时,epoll会完全取代select / poll吗?(could epoll totally replace select/poll when it is available?)

我是插座新手,我正在学习/阅读一些epoll材料和代码。 我的问题是,当epoll在系统(Linux)中可用时,epoll可以完全取代select / poll吗?

我认为套接字编程也应该在实践中遵循一些范例。 当我阅读代码时,我发现一些“选择”带有“epoll”:

  1. 服务器代码在处理阻塞套接字时使用select。 我认为epoll(LT)的行为与select相同,所以可以使用epoll替换所有select。

  2. 一些遗留代码使用epoll进行监控。 事件返回后,在相应的fd上使用select以在读/写之前“检查”它。 我不太确定这个“选择”的含义。

我对这些“选择”代码感到困惑,希望有人可以提供帮助。


i am new to sockets and i am learning/reading some epoll materials and codes. My questions is that could epoll totally replace select/poll when epoll is available in system(Linux)?

i think socket programming also should have some paradigms to follow in practice. When i was reading codes, i find some "select" with "epoll":

  1. a server code use select when it deals with blocking socket. I think epoll(LT) behaves just the same as select so it is ok to use epoll to replace all select.

  2. some legacy code use epoll to monitor. After events returns, select is used on corresponding fd to "check" it just before read/write. i am not quite sure the meaning of this "select".

i am confused about these "select" code and hope someone can help.


原文:https://stackoverflow.com/questions/10119860
更新时间:2023-10-09 21:10

最满意答案

你可以使用y w (Yank在Word中)。 虽然它的击键次数也是一样多。 如果你在这个词的开头,你可以放下并使用y wy e

或者,您可以按照您喜欢的方式将命令映射到某个键。 例如,你可以把它放在你的vimrc文件中:

nmap <F8> yiw

F8键就在*键附近,所以很容易记住它的作用类似于*字高亮。 这将是一个单一的关键词来拉开这个词。

更新:

Satoru.Logic的评论绝对是一个好方法。 如果你不确定<leader>是什么意思,那么看看这篇文章。


You can use y i w (Yank In Word). Though it is just as many keystrokes. If you are at the beginning of the word you can drop the i and use either y w or y e.

Alternatively you can map the command to a key any way you like. For example, you could put this in your vimrc file:

nmap <F8> yiw

The F8 key is right near the * key so it would be easy to remember that it acts similar to the * word highlight. This would be a single key to yank the word.

UPDATE:

Satoru.Logic's comment is definitely a good way to go. If you are not sure what <leader> means, have a look at this post.

相关问答

更多
  • 您的问题中缺少一些重要信息: $ vim --version输出$ vim --version ? OS? CLI还是GUI? 本地或远程? 你使用tmux吗? 屏幕? 如果你的Vim是用剪贴板支持构建的,你应该在普通模式下使用这样的剪贴板寄存器: gg"+yG 如果您的Vim没有剪贴板支持,您可以设法通过其他程序将文本从Vim复制到操作系统剪贴板。 这很大程度上取决于你的操作系统,但你没有说出它是什么,所以我们不能真正帮助。 但是,如果你的Vim坏了,最好的办法是安装一个合适的剪贴板支持版本,但我不能告 ...
  • 检查此Vim提示: 搜索视觉选择的文本 或者您可以用y轻松选择所选文本,然后转到搜索模式/ ,然后您可以使用Ctrl + R 0粘贴最后一个打印的文本 Check this Vim tip: Search for visually selected text Or you can simply yank the selected text with y and go to search mode /, then you can paste the last yanked text with Ctrl+R 0 ...
  • 一个WORD总是被空白界定。 单词由非关键字字符分隔,可以配置。 空格字符不是关键字,通常其他字符(如()[],- )也不是。 因此,一个字通常比一个WORD小; 字词导航更细致。 例 This "stuff" is not-so difficult! wwww wwwww ww www ww wwwwwwwww " (key)words, delimiters are non-keywords: "-! and whitespace WWWW WWWWWWW WW WWWWWW WWWWWWWW ...
  • 喜欢这个: /\ \<表示一个单词的开始, \>表示一个单词的结尾, 添加@ Roe的评论: VIM为此提供了一个快捷方式。 如果您已经在屏幕上显示了单词 ,并且想要查找其他实例,则可以将光标放在该单词上,然后按'*'在文件中向前搜索或'#'向后搜索。 like this: /\ \< means beginning of a word, and \> means the end of a word, Adding @Roe's comment: VIM provides a ...
  • *注册将这样做。 在Windows中, +和*是等效的。 在unix中, +和*之间有一个微妙的区别: 在Windows下,*和+寄存器是等效的。 对于X11系统,它们有所不同。 对于X11系统,*是选择,+是剪切缓冲区(如剪贴板)。 http://vim.wikia.com/wiki/Accessing_the_system_clipboard *大概是你想要的大部分时间,所以我使用*因为它的功能,我期望在这两个环境。 在Linux发行版中,由于某种原因,您必须首先安装vim-gtk才能获得剪贴板功能。 ...
  • 打开工具 - >选项 - >编辑器 创建一个新的宏 用于宏: select-identifier copy-to-clipboard 设置它的快捷方式,啊-la Ctrl + Shift + /你可以摇滚。 Open up Tools->Options->Editor Create a new macro Use this for the macro: select-identifier copy-to-clipboard Set up a shortcut for it, ah-la Ctrl + S ...
  • 在插入模式下,您可以使用Ctrl + Y从前一行的相应字符位置复制字符。 只需按住键并等待键盘重复即可到达行尾。 In insert mode, you can use Ctrl+Y to copy characters from the corresponding character position on the previous line. Just hold down the key and wait for the keyboard repeat to get you to the end of ...
  • 你可以使用y 我 w (Yank在Word中)。 虽然它的击键次数也是一样多。 如果你在这个词的开头,你可以放下我并使用y w或y e 。 或者,您可以按照您喜欢的方式将命令映射到某个键。 例如,你可以把它放在你的vimrc文件中: nmap yiw F8键就在*键附近,所以很容易记住它的作用类似于*字高亮。 这将是一个单一的关键词来拉开这个词。 更新: Satoru.Logic的评论绝对是一个好方法。 如果你不确定是什么意思,那么看看这篇文章。 You can use y i ...
  • 您可以使用substitute命令和行范围执行此操作: :186,1413s/^\w\+/& &/ 186,1413是要操作的行的范围(开始,结束)。 s是substitute缩写(参见:h substitute ),它执行正则表达式搜索和替换。 ^\w\+匹配任何单词字符(字母数字和下划线,没有空格)。 & &将匹配的单词替换为自身,四个空格,并再次替换。 第一个单词后面的任何文字都会附加到该行的末尾。 You can do this with the substitute command and ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。