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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
25 deletions
+23
-25
libuniset2.spec
conf/libuniset2.spec
+3
-0
CommonEventLoop.h
include/CommonEventLoop.h
+1
-1
CommonEventLoop.cc
src/Processes/CommonEventLoop.cc
+19
-24
No files found.
conf/libuniset2.spec
View file @
07a7e00a
...
@@ -511,6 +511,9 @@ rm -f %buildroot%_libdir/*.la
...
@@ -511,6 +511,9 @@ rm -f %buildroot%_libdir/*.la
* Tue Sep 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt19.1
* Tue Sep 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt19.1
- Rebuild with poco 1.7.9
- 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
# * Thu Jun 01 2017 Pavel Vainerman <pv@altlinux.ru> 2.6-alt26
# - test build (devel)
# - test build (devel)
...
...
include/CommonEventLoop.h
View file @
07a7e00a
...
@@ -116,7 +116,7 @@ namespace uniset
...
@@ -116,7 +116,7 @@ namespace uniset
std
::
promise
<
bool
>&
result
;
std
::
promise
<
bool
>&
result
;
};
};
std
::
queue
<
WatcherInfo
>
wactlist
;
std
::
shared_ptr
<
WatcherInfo
>
wact_info
=
{
nullptr
}
;
std
::
mutex
wact_mutex
;
std
::
mutex
wact_mutex
;
ev
::
async
evprep
;
ev
::
async
evprep
;
...
...
src/Processes/CommonEventLoop.cc
View file @
07a7e00a
...
@@ -54,17 +54,18 @@ namespace uniset
...
@@ -54,17 +54,18 @@ namespace uniset
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
bool
CommonEventLoop
::
activateWatcher
(
EvWatcher
*
w
,
size_t
waitTimeout_msec
)
bool
CommonEventLoop
::
activateWatcher
(
EvWatcher
*
w
,
size_t
waitTimeout_msec
)
{
{
std
::
lock_guard
<
std
::
mutex
>
l
(
wact_mutex
);
std
::
promise
<
bool
>
p
;
std
::
promise
<
bool
>
p
;
WatcherInfo
winfo
(
w
,
p
);
wact_info
=
std
::
make_shared
<
WatcherInfo
>
(
w
,
p
);
auto
result
=
p
.
get_future
();
{
auto
result
=
p
.
get_future
();
std
::
unique_lock
<
std
::
mutex
>
l
(
wact_mutex
);
wactlist
.
push
(
winfo
);
}
bool
ret
=
true
;
bool
ret
=
true
;
if
(
!
evprep
.
is_active
()
)
evprep
.
start
();
// посылаем сигнал для обработки
// посылаем сигнал для обработки
evprep
.
send
();
// будим default loop
evprep
.
send
();
// будим default loop
...
@@ -88,6 +89,7 @@ namespace uniset
...
@@ -88,6 +89,7 @@ namespace uniset
}
}
}
}
wact_info
=
nullptr
;
return
ret
;
return
ret
;
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
...
@@ -196,25 +198,18 @@ namespace uniset
...
@@ -196,25 +198,18 @@ namespace uniset
return
;
return
;
}
}
{
if
(
!
wact_info
)
std
::
lock_guard
<
std
::
mutex
>
lock
(
wact_mutex
);
return
;
while
(
!
wactlist
.
empty
()
)
{
auto
winf
=
wactlist
.
front
();
wactlist
.
pop
();
try
try
{
{
winf
.
watcher
->
evprepare
(
loop
);
wact_info
->
watcher
->
evprepare
(
loop
);
winf
.
result
.
set_value
(
true
);
wact_info
->
result
.
set_value
(
true
);
}
}
catch
(
std
::
exception
&
ex
)
catch
(
std
::
exception
&
ex
)
{
{
cerr
<<
"(CommonEventLoop::onPrepare): evprepare err: "
<<
ex
.
what
()
<<
endl
;
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