Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
a2ea70c7
Commit
a2ea70c7
authored
9 years ago
by
Lorenz Meier
Browse files
Options
Downloads
Patches
Plain Diff
Simulator: Move to semaphore abstraction
parent
fa27e59a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/simulator/simulator.h
+6
-6
6 additions, 6 deletions
src/modules/simulator/simulator.h
with
6 additions
and
6 deletions
src/modules/simulator/simulator.h
+
6
−
6
View file @
a2ea70c7
...
...
@@ -125,7 +125,7 @@ public:
_max_readers
(
readers
),
_report_len
(
sizeof
(
RType
))
{
sem_init
(
&
_lock
,
0
,
_max_readers
);
px4_
sem_init
(
&
_lock
,
0
,
_max_readers
);
}
~
Report
()
{};
...
...
@@ -149,23 +149,23 @@ public:
}
protected
:
void
read_lock
()
{
sem_wait
(
&
_lock
);
}
void
read_unlock
()
{
sem_post
(
&
_lock
);
}
void
read_lock
()
{
px4_
sem_wait
(
&
_lock
);
}
void
read_unlock
()
{
px4_
sem_post
(
&
_lock
);
}
void
write_lock
()
{
for
(
int
i
=
0
;
i
<
_max_readers
;
i
++
)
{
sem_wait
(
&
_lock
);
px4_
sem_wait
(
&
_lock
);
}
}
void
write_unlock
()
{
for
(
int
i
=
0
;
i
<
_max_readers
;
i
++
)
{
sem_post
(
&
_lock
);
px4_
sem_post
(
&
_lock
);
}
}
int
_readidx
;
sem_t
_lock
;
px4_
sem_t
_lock
;
const
int
_max_readers
;
const
int
_report_len
;
RType
_buf
[
2
];
...
...
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