Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Baitboat
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
OpenSource
Baitboat
Commits
28b4ae1c
Commit
28b4ae1c
authored
11 years ago
by
Andrew Tridgell
Browse files
Options
Downloads
Patches
Plain Diff
HAL_Linux: improved latency of timed semaphores
parent
6fa55d10
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
libraries/AP_HAL_Linux/Semaphores.cpp
+10
-4
10 additions, 4 deletions
libraries/AP_HAL_Linux/Semaphores.cpp
with
10 additions
and
4 deletions
libraries/AP_HAL_Linux/Semaphores.cpp
+
10
−
4
View file @
28b4ae1c
...
...
@@ -18,11 +18,17 @@ bool LinuxSemaphore::take(uint32_t timeout_ms)
if
(
timeout_ms
==
0
)
{
return
pthread_mutex_lock
(
&
_lock
)
==
0
;
}
while
(
timeout_ms
--
>
0
)
{
if
(
take_nonblocking
())
return
true
;
hal
.
scheduler
->
delay
(
1
);
if
(
take_nonblocking
())
{
return
true
;
}
return
take_nonblocking
();
uint32_t
start
=
hal
.
scheduler
->
micros
();
do
{
hal
.
scheduler
->
delay_microseconds
(
200
);
if
(
take_nonblocking
())
{
return
true
;
}
}
while
((
hal
.
scheduler
->
micros
()
-
start
)
<
timeout_ms
*
1000
);
return
false
;
}
bool
LinuxSemaphore
::
take_nonblocking
()
...
...
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