Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ChimeraTK Mirror
ApplicationCore
Commits
34384e6b
Commit
34384e6b
authored
8 years ago
by
Martin Christoph Hierholzer
Browse files
Options
Downloads
Patches
Plain Diff
make use of the new blocking read() implementation of the ControlSystemAdapter
parent
af15c55a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/ArrayAccessor.h
+2
-4
2 additions, 4 deletions
include/ArrayAccessor.h
include/FanOut.h
+11
-15
11 additions, 15 deletions
include/FanOut.h
include/ImplementationAdapter.h
+1
-4
1 addition, 4 deletions
include/ImplementationAdapter.h
include/ScalarAccessor.h
+2
-4
2 additions, 4 deletions
include/ScalarAccessor.h
with
16 additions
and
27 deletions
include/ArrayAccessor.h
+
2
−
4
View file @
34384e6b
...
...
@@ -32,10 +32,8 @@ namespace ChimeraTK {
void
read
()
{
if
(
Accessor
<
UserType
>::
_mode
==
UpdateMode
::
push
)
{
while
(
impl
->
readNonBlocking
()
==
false
)
{
/// @todo TODO proper blocking implementation
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
}
impl
->
read
();
boost
::
this_thread
::
interruption_point
();
}
else
{
/// @todo TODO empty the queue to always receive the latest value
...
...
This diff is collapsed.
Click to expand it.
include/FanOut.h
+
11
−
15
View file @
34384e6b
...
...
@@ -110,34 +110,22 @@ namespace ChimeraTK {
void
run
()
{
assert
(
_direction
==
VariableDirection
::
consuming
);
while
(
true
)
{
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
if
(
hasExternalTrigger
)
{
// wait for external trigger (if present)
/// @todo TODO replace with proper blocking implementation when supported by the CSA
while
(
externalTrigger
->
readNonBlocking
()
==
false
)
{
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
}
externalTrigger
->
read
();
// receive data
impl
->
readNonBlocking
();
}
else
{
// receive data
while
(
impl
->
readNonBlocking
()
==
false
)
{
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
}
impl
->
read
();
}
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
for
(
auto
&
slave
:
slaves
)
{
// send out copies to slaves
// do not send copy if no data is expected (e.g. trigger)
if
(
slave
->
getNumberOfSamples
()
!=
0
)
{
slave
->
accessChannel
(
0
)
=
impl
->
accessChannel
(
0
);
}
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
slave
->
write
();
}
}
...
...
@@ -180,7 +168,15 @@ namespace ChimeraTK {
}
void
read
()
{
throw
std
::
logic_error
(
"Blocking read is not supported by process array."
);
impl
->
read
();
mtca4u
::
NDRegisterAccessor
<
UserType
>::
buffer_2D
[
0
].
swap
(
impl
->
accessChannel
(
0
));
for
(
auto
&
slave
:
slaves
)
{
// send out copies to slaves
// do not send copy if no data is expected (e.g. trigger)
if
(
slave
->
getNumberOfSamples
()
!=
0
)
{
slave
->
accessChannel
(
0
)
=
mtca4u
::
NDRegisterAccessor
<
UserType
>::
buffer_2D
[
0
];
}
slave
->
write
();
}
}
bool
readNonBlocking
()
{
...
...
This diff is collapsed.
Click to expand it.
include/ImplementationAdapter.h
+
1
−
4
View file @
34384e6b
...
...
@@ -51,10 +51,7 @@ namespace ChimeraTK {
/** Synchronise sender and receiver. This function is executed in the separate thread. */
void
run
()
{
while
(
true
)
{
while
(
!
_receiver
->
readNonBlocking
())
{
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
}
_receiver
->
read
();
_sender
->
accessChannel
(
0
)
=
_receiver
->
accessChannel
(
0
);
_sender
->
write
();
}
...
...
This diff is collapsed.
Click to expand it.
include/ScalarAccessor.h
+
2
−
4
View file @
34384e6b
...
...
@@ -32,10 +32,8 @@ namespace ChimeraTK {
void
read
()
{
if
(
Accessor
<
UserType
>::
_mode
==
UpdateMode
::
push
)
{
while
(
impl
->
readNonBlocking
()
==
false
)
{
/// @todo TODO proper blocking implementation
boost
::
this_thread
::
yield
();
boost
::
this_thread
::
interruption_point
();
}
impl
->
read
();
boost
::
this_thread
::
interruption_point
();
}
else
{
/// @todo TODO empty the queue to always receive the latest value
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment