Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kernel
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
Container Registry
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
redox-os
kernel
Commits
5a42b6dd
Verified
Commit
5a42b6dd
authored
5 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Add notify_signal method to WaitCondition to simulate being woken by a signal
parent
76e0ed2e
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/sync/wait_condition.rs
+13
-1
13 additions, 1 deletion
src/sync/wait_condition.rs
with
13 additions
and
1 deletion
src/sync/wait_condition.rs
+
13
−
1
View file @
5a42b6dd
...
...
@@ -16,6 +16,7 @@ impl WaitCondition {
}
}
// Notify all waiters
pub
fn
notify
(
&
self
)
->
usize
{
let
mut
contexts
=
self
.contexts
.lock
();
let
len
=
contexts
.len
();
...
...
@@ -25,6 +26,17 @@ impl WaitCondition {
len
}
// Notify as though a signal woke the waiters
pub
unsafe
fn
notify_signal
(
&
self
)
->
usize
{
let
contexts
=
self
.contexts
.lock
();
let
len
=
contexts
.len
();
for
context_lock
in
contexts
.iter
()
{
context_lock
.write
()
.unblock
();
}
len
}
// Wait until notified. Returns false if resumed by a signal or the notify_signal function
pub
fn
wait
(
&
self
)
->
bool
{
let
id
;
{
...
...
@@ -73,6 +85,6 @@ impl WaitCondition {
impl
Drop
for
WaitCondition
{
fn
drop
(
&
mut
self
){
self
.notify
()
;
unsafe
{
self
.notify
_signal
()
}
;
}
}
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