Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
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
relibc
Commits
22ffed70
Verified
Commit
22ffed70
authored
2 years ago
by
Jacob Lorentzon
Browse files
Options
Downloads
Patches
Plain Diff
Fix embarrasing deadlock!
parent
b455e2e3
No related branches found
No related tags found
1 merge request
!380
Replace pthreads-emb with a native implementation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/sync/mod.rs
+7
-7
7 additions, 7 deletions
src/sync/mod.rs
with
7 additions
and
7 deletions
src/sync/mod.rs
+
7
−
7
View file @
22ffed70
...
...
@@ -35,7 +35,7 @@ pub trait FutexTy {
pub
trait
FutexAtomicTy
{
type
Ty
:
FutexTy
;
fn
as_mut_
ptr
(
&
self
)
->
*
mut
Self
::
Ty
;
fn
ptr
(
&
self
)
->
*
mut
Self
::
Ty
;
}
impl
FutexTy
for
u32
{
fn
conv
(
self
)
->
i32
{
...
...
@@ -50,15 +50,15 @@ impl FutexTy for i32 {
impl
FutexAtomicTy
for
AtomicU32
{
type
Ty
=
u32
;
fn
as_mut_
ptr
(
&
self
)
->
*
mut
u32
{
AtomicU32
::
as_
mut_
ptr
(
self
)
fn
ptr
(
&
self
)
->
*
mut
u32
{
AtomicU32
::
as_ptr
(
self
)
}
}
impl
FutexAtomicTy
for
AtomicI32
{
type
Ty
=
i32
;
fn
as_mut_
ptr
(
&
self
)
->
*
mut
i32
{
AtomicI32
::
as_
mut_
ptr
(
self
)
fn
ptr
(
&
self
)
->
*
mut
i32
{
AtomicI32
::
as_ptr
(
self
)
}
}
...
...
@@ -71,10 +71,10 @@ pub unsafe fn futex_wait_ptr<T: FutexTy>(ptr: *mut T, value: T, timeout_opt: Opt
Sys
::
futex
(
ptr
.cast
(),
FUTEX_WAIT
,
value
.conv
(),
timeout_opt
.map_or
(
0
,
|
t
|
t
as
*
const
_
as
usize
))
==
Ok
(
0
)
}
pub
fn
futex_wake
(
atomic
:
&
impl
FutexAtomicTy
,
n
:
i32
)
->
usize
{
unsafe
{
futex_wake_ptr
(
atomic
.
as_mut_
ptr
(),
n
)
}
unsafe
{
futex_wake_ptr
(
atomic
.ptr
(),
n
)
}
}
pub
fn
futex_wait
<
T
:
FutexAtomicTy
>
(
atomic
:
&
T
,
value
:
T
::
Ty
,
timeout_opt
:
Option
<&
timespec
>
)
->
bool
{
unsafe
{
futex_wait_ptr
(
atomic
.
as_mut_
ptr
(),
value
,
timeout_opt
)
}
unsafe
{
futex_wait_ptr
(
atomic
.ptr
(),
value
,
timeout_opt
)
}
}
pub
fn
wait_until_generic
<
F1
,
F2
>
(
word
:
&
AtomicInt
,
attempt
:
F1
,
mark_long
:
F2
,
long
:
c_int
)
where
...
...
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