Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e53a25cb
Commit
e53a25cb
authored
Nov 24, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event: add API documentation
parent
41e71459
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
1 deletion
+38
-1
Loop.hxx
src/event/Loop.hxx
+21
-0
MultiSocketMonitor.hxx
src/event/MultiSocketMonitor.hxx
+4
-1
ServerSocket.hxx
src/event/ServerSocket.hxx
+3
-0
SocketMonitor.hxx
src/event/SocketMonitor.hxx
+6
-0
TimeoutMonitor.hxx
src/event/TimeoutMonitor.hxx
+4
-0
No files found.
src/event/Loop.hxx
View file @
e53a25cb
...
...
@@ -45,6 +45,15 @@ class SocketMonitor;
#include <assert.h>
/**
* An event loop that polls for events on file/socket descriptors.
*
* This class is not thread-safe, all methods must be called from the
* thread that runs it, except where explicitly documented as
* thread-safe.
*
* @see SocketMonitor, MultiSocketMonitor, TimeoutMonitor, IdleMonitor
*/
class
EventLoop
final
#ifdef USE_EPOLL
:
private
SocketMonitor
...
...
@@ -107,10 +116,18 @@ public:
EventLoop
(
Default
dummy
=
Default
());
~
EventLoop
();
/**
* A caching wrapper for MonotonicClockMS().
*/
unsigned
GetTimeMS
()
const
{
return
now_ms
;
}
/**
* Stop execution of this #EventLoop at the next chance. This
* method is thread-safe and non-blocking: after returning, it
* is not guaranteed that the EventLoop has really stopped.
*/
void
Break
();
bool
AddFD
(
int
_fd
,
unsigned
flags
,
SocketMonitor
&
m
)
{
...
...
@@ -138,6 +155,10 @@ public:
void
AddCall
(
std
::
function
<
void
()
>
&&
f
);
/**
* The main function of this class. It will loop until
* Break() gets called. Can be called only once.
*/
void
Run
();
private
:
...
...
src/event/MultiSocketMonitor.hxx
View file @
e53a25cb
...
...
@@ -47,7 +47,10 @@
class
EventLoop
;
/**
* Monitor multiple sockets.
* Similar to #SocketMonitor, but monitors multiple sockets. To use
* it, implement the methods PrepareSockets() and DispatchSockets().
* In PrepareSockets(), use UpdateSocketList() and AddSocket().
* DispatchSockets() will be called if at least one socket is ready.
*/
class
MultiSocketMonitor
#ifdef USE_EPOLL
...
...
src/event/ServerSocket.hxx
View file @
e53a25cb
...
...
@@ -36,6 +36,9 @@ typedef void (*server_socket_callback_t)(int fd,
class
OneServerSocket
;
/**
* A socket that accepts incoming stream connections (e.g. TCP).
*/
class
ServerSocket
{
friend
class
OneServerSocket
;
...
...
src/event/SocketMonitor.hxx
View file @
e53a25cb
...
...
@@ -43,6 +43,12 @@
class
EventLoop
;
/**
* Monitor events on a socket. Call Schedule() to announce events
* you're interested in, or Cancel() to cancel your subscription. The
* #EventLoop will invoke virtual method OnSocketReady() as soon as
* any of the subscribed events are ready.
*/
class
SocketMonitor
{
#ifdef USE_EPOLL
#else
...
...
src/event/TimeoutMonitor.hxx
View file @
e53a25cb
...
...
@@ -28,6 +28,10 @@
class
EventLoop
;
/**
* This class monitors a timeout. Use Schedule() to begin the timeout
* or Cancel() to cancel it.
*/
class
TimeoutMonitor
{
#ifdef USE_EPOLL
friend
class
EventLoop
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment