<commit_before><commit_msg>*** empty log message ***<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> UDT Reference</title>
<link rel="stylesheet" href="udtdoc.css" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>

<body>
<div class="ref_head">&nbsp;UDT Reference: Functions</div>

<h4 class="func_name"><strong>epoll</strong></h4>
<p>The <b>epoll</b> method can be used to effectively poll the IO events for a large number of sockets. It includes the following APIs.</p>

<div class="code">
  int epoll_create();<br />
    int epoll_add(const int <span class="style1">eid</span>, const std::set&lt;UDTSOCKET&gt;* <span class="style1">socks</span>, const std::set&lt;int&gt;* <span class="style1">locals</span> = NULL);<br />
    int epoll_remove(const int <span class="style1">eid</span>, const std::set&lt;int&gt;* socks, const std::set&lt;int&gt;* <span class="style1">locals</span> = NULL);<br />
    int epoll_wait(const int <span class="style1">eid</span>, std::set&lt;int&gt;* <span class="style1">readfds</span>, std::set&lt;int&gt;* <span class="style1">writefds</span>, int64_t msTimeOut, std::set&lt;int&gt;* <span class="style1">lrfds</span> = NULL, std::set&lt;int&gt;* <span class="style1">wrfds</span> = NULL);<br />
    int epoll_release(const int <span class="style1">eid</span>);</div>

<h5>Parameters</h5>
<dl>
  <dt><em>eid</em></dt>
  <dd>[in] The epoll ID allocated by epoll_create and used by subsequent epoll functions. </dd>
  <dt><em>socks</em></dt>
  <dd>[in] set of UDT sockets to be added to or removed from the epoll.</dd>
  <dt><em>locals</em></dt>
  <dd>[in] set of system sockets (including general file descriptors on *nix systems) to be added to or removed from the epoll.</dd>
  <dt><em>readfds</em></dt>
  <dd>[out] Optional pointer to a set of UDT sockets that are ready to read.</dd>
  <dt><em>writefds</em></dt>
  <dd>[out] Optional pointer to a set of UDT sockets that are ready to write, or are broken.</dd>
  <dt><em>msTimeOut</em></dt>
  <dd>[in] The time that this epoll should wait for the status change in the input groups, in milliseconds.</dd>
  <dt><em>readfds</em></dt>
  <dd>[out] Optional pointer to a set of system sockets that are ready to read.</dd>
  <dt><em>writefds</em></dt>
  <dd>[out] Optional pointer to a set of system sockets that are ready to write, or are broken.</dd>
</dl>

<h5>Return Value</h5>
<p>If successful, <strong>epoll_create</strong> returns a new epoll ID, <strong>epoll_wait</strong> returns the total number of UDT sockets and system sockets ready for IO, and the other three functions return 0. On error, all functions return negative error values. The error can be one of the following. </p>


<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td width="17%" class="table_headline"><strong>Error Name</strong></td>
    <td width="17%" class="table_headline"><strong>Error Code</strong></td>
    <td width="83%" class="table_headline"><strong>Comment</strong></td>
  </tr>
  <tr>
    <td>EINVPOLLID</td>
    <td>5013</td>
    <td>poll ID is invalid. </td>
  </tr>
</table>

<h5>Description</h5>
<p>The <strong>epoll</strong> functions provides a highly scalable and efficient way to wait for UDT sockets IO events. It should be used instead of <a href="select.htm">select</a> and <a href="selectex.htm">selectEx</a> when the application needs to wait for a very large number of sockets. In addition, epoll also offers to wait on system sockets at the same time, which can be convenient when an application uses both UDT and TCP/UDP. </p>
<p>Applications should use <strong>epoll_create</strong> to create an epoll ID and use <strong>epoll_add</strong> and <strong>epoll_remove</strong> to add/remove sockets. If a socket is already in the epoll set, it will be ignored if being added again. Invalid or closed sockets will also be ignored with no errors returned. Multiple epoll entities can be created and there is no upper limits as long as system resource allows. There is also no hard limit on the number of UDT sockets and system descriptors to be watched.</p>
<p>Both read and write events will be traced automatically. Exceptions are categorized as write events, so when the application choose to write to this socket, it will detect the exception. </p>
<dl>
  <h5>See Also</h5>
  <p><strong><a href="select.htm">select</a></strong>, <a href="selectex.htm"><strong>selectEx</strong> </a></p>
  <dt>&nbsp;</dt>
</dl>

</body>
</html>
{'fraction_non_alphanumeric': 0.1603295310519645, 'fraction_numerical': 0.012040557667934094, 'mean_word_length': 4.955974842767295, 'pattern_counts': {'":': 0, '<': 175, '<?xml version=': 0, '>': 175, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7273834', 'n_tokens_mistral': 1638, 'n_tokens_neox': 1563, 'n_words': 531}