Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
07a7e00a
Commit
07a7e00a
authored
Jun 01, 2017
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(CommonEventLoop): переделал на активацию только одного за один раз
(вместо списка)
parent
79617424
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
19 deletions
+17
-19
libuniset2.spec
conf/libuniset2.spec
+3
-0
CommonEventLoop.h
include/CommonEventLoop.h
+1
-1
CommonEventLoop.cc
src/Processes/CommonEventLoop.cc
+13
-18
No files found.
conf/libuniset2.spec
View file @
07a7e00a
...
...
@@ -511,6 +511,9 @@ rm -f %buildroot%_libdir/*.la
* Tue Sep 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt19.1
- Rebuild with poco 1.7.9
# * Thu Jun 01 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt27
# - test build (devel)
# * Thu Jun 01 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt26
# - test build (devel)
...
...
include/CommonEventLoop.h
View file @
07a7e00a
...
...
@@ -116,7 +116,7 @@ namespace uniset
std
::
promise
<
bool
>&
result
;
};
std
::
queue
<
WatcherInfo
>
wactlist
;
std
::
shared_ptr
<
WatcherInfo
>
wact_info
=
{
nullptr
}
;
std
::
mutex
wact_mutex
;
ev
::
async
evprep
;
...
...
src/Processes/CommonEventLoop.cc
View file @
07a7e00a
...
...
@@ -54,17 +54,18 @@ namespace uniset
// ---------------------------------------------------------------------------
bool
CommonEventLoop
::
activateWatcher
(
EvWatcher
*
w
,
size_t
waitTimeout_msec
)
{
std
::
lock_guard
<
std
::
mutex
>
l
(
wact_mutex
);
std
::
promise
<
bool
>
p
;
WatcherInfo
winfo
(
w
,
p
);
auto
result
=
p
.
get_future
();
wact_info
=
std
::
make_shared
<
WatcherInfo
>
(
w
,
p
);
{
std
::
unique_lock
<
std
::
mutex
>
l
(
wact_mutex
);
wactlist
.
push
(
winfo
);
}
auto
result
=
p
.
get_future
();
bool
ret
=
true
;
if
(
!
evprep
.
is_active
()
)
evprep
.
start
();
// посылаем сигнал для обработки
evprep
.
send
();
// будим default loop
...
...
@@ -88,6 +89,7 @@ namespace uniset
}
}
wact_info
=
nullptr
;
return
ret
;
}
// ---------------------------------------------------------------------------
...
...
@@ -196,25 +198,18 @@ namespace uniset
return
;
}
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
wact_mutex
);
while
(
!
wactlist
.
empty
()
)
{
auto
winf
=
wactlist
.
front
();
wactlist
.
pop
();
if
(
!
wact_info
)
return
;
try
{
winf
.
watcher
->
evprepare
(
loop
);
winf
.
result
.
set_value
(
true
);
wact_info
->
watcher
->
evprepare
(
loop
);
wact_info
->
result
.
set_value
(
true
);
}
catch
(
std
::
exception
&
ex
)
{
cerr
<<
"(CommonEventLoop::onPrepare): evprepare err: "
<<
ex
.
what
()
<<
endl
;
winf
.
result
.
set_value
(
false
);
}
}
wact_info
->
result
.
set_value
(
false
);
}
}
// -------------------------------------------------------------------------
...
...
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