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
be3d2188
Commit
be3d2188
authored
Jan 30, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
event/SocketMonitor: wake up the event loop after flag change
parent
18e429a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
SocketMonitor.cxx
src/event/SocketMonitor.cxx
+6
-0
SocketMonitor.hxx
src/event/SocketMonitor.hxx
+8
-0
No files found.
src/event/SocketMonitor.cxx
View file @
be3d2188
...
...
@@ -159,3 +159,9 @@ SocketMonitor::Write(const void *data, size_t length)
return
send
(
Get
(),
(
const
char
*
)
data
,
length
,
flags
);
}
void
SocketMonitor
::
CommitEventFlags
()
{
loop
.
WakeUp
();
}
src/event/SocketMonitor.hxx
View file @
be3d2188
...
...
@@ -89,26 +89,32 @@ public:
void
Schedule
(
unsigned
flags
)
{
poll
.
events
=
flags
;
poll
.
revents
&=
flags
;
CommitEventFlags
();
}
void
Cancel
()
{
poll
.
events
=
0
;
CommitEventFlags
();
}
void
ScheduleRead
()
{
poll
.
events
|=
READ
|
HANGUP
|
ERROR
;
CommitEventFlags
();
}
void
ScheduleWrite
()
{
poll
.
events
|=
WRITE
;
CommitEventFlags
();
}
void
CancelRead
()
{
poll
.
events
&=
~
(
READ
|
HANGUP
|
ERROR
);
CommitEventFlags
();
}
void
CancelWrite
()
{
poll
.
events
&=
~
WRITE
;
CommitEventFlags
();
}
ssize_t
Read
(
void
*
data
,
size_t
length
);
...
...
@@ -128,6 +134,8 @@ public:
gpointer
user_data
);
private
:
void
CommitEventFlags
();
bool
Check
()
const
{
return
(
poll
.
revents
&
poll
.
events
)
!=
0
;
}
...
...
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